I tried to zip a text file, but the downloaded zip file doesn't compress the size.
Here is my code:
var zip1 = new JSZip();
zip1.file("test.txt", "a very long text here");
zip1.generateAsync({type:"blob"})
.then(function(content) {
saveAs(content, "test.zip");
});
Could you please tell me what went wrong?
Use the compression option:
zip1.generateAsync({
type: "blob",
compression: "DEFLATE"
}).then(...)
Thanks, it works.
Cool !
@dduponchel
It is not working.
Most helpful comment
Use the
compressionoption: