Closed ticup closed 12 years ago
Use this instead:
var data = zip.generate({base64:false,compression:'DEFLATE'});
tried that, doesn't fix it.
Ok, thanks for reporting. Found two solutions for this:
1) Save using base64 encoding:
var fs = require("fs");
var zip = new require('node-zip')();
zip.file('test.txt', 'hello there');
var data = zip.generate({base64:true,compression:'DEFLATE'});
fs.writeFile('test.zip', data, 'base64');
2) Save using binary encoding:
var fs = require("fs");
var zip = new require('node-zip')();
zip.file('test.txt', 'hello there');
var data = zip.generate({base64:false,compression:'DEFLATE'});
fs.writeFile('test.zip', data, 'binary');
It worked for me this time. Let me know how it goes.
Both solutions do indeed work!
Thanks for the quick fix, maybe add it to the readme?
cheers.
Definitely, thanks for reporting.
Cheers.
Hi,
I'm trying to write the zip to a file, but its unable to open the written file properly, saying: "the file is corrupted or is of unsupported format".
Using node 0.6.6 and 0.8.11 on OSX, tried opening with Zipeg and Archive Utility.
Thanks in advance.