Skip to content

Instantly share code, notes, and snippets.

@jbryson3
Created August 13, 2014 15:33
Show Gist options
  • Save jbryson3/eeb7bc3907bd0f2decdf to your computer and use it in GitHub Desktop.
Save jbryson3/eeb7bc3907bd0f2decdf to your computer and use it in GitHub Desktop.
Using jszip with node to zip up local files
var JSZip = require('jszip');
var zip = new JSZip();
zip.file('image0.png', require('fs').readFileSync('files/image0.png'), {compression: "DEFLATE"});
var content = zip.generate({type:"nodebuffer"});
require('fs').writeFileSync('zippy.zip', content);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment