title: How to zip a directory, recursively, without getting malformed files when you try to unzip in node.js
body: <p>So far I have tried <a href="https://github.com/cthackers/adm-zip/wiki/ADM-ZIP#void-addlocalfolderstring-localpath-string-zippath" rel="nofollow noreferrer">ADM-ZIP</a> and <a href="https://github.com/owenchong/easy-zip" rel="nofollow noreferrer">easy-zip</a>. Both of them create a zip that is mostly successful but has some malformed files:</p>
  
  <p><img src="https://i.stack.imgur.com/Cjrx4.png" alt="enter image description here"></p>
  
  <p>This happens with a variety of file types (including just regular pictures and html pages). I suspect that the file type isn't even an issue. Either way, I can't use it if it doesn't work perfectly.</p>
  
  <p>Some people have suggested <a href="https://github.com/Skomski/node-archive" rel="nofollow noreferrer">node-archive</a> but there are no instructions for how to zip a file, let alone recursively zip a directory while keeping its file structure. </p>
  
  <p><strong>update</strong></p>
  
  <p>as requested here is the code i am using (adm-zip)</p>
  
  <pre><code>var Zip = require("adm-zip");
  var zip = new Zip();
  zip.addLocalFolder("C:\\test");
  zip.writeZip("C:\\test\\color.zip");
  </code></pre>