Created
August 13, 2014 15:33
-
-
Save jbryson3/eeb7bc3907bd0f2decdf to your computer and use it in GitHub Desktop.
Using jszip with node to zip up local files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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