Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zipped file with same size of original file #503

Open
mikeiasNS opened this issue Feb 9, 2018 · 5 comments
Open

zipped file with same size of original file #503

mikeiasNS opened this issue Feb 9, 2018 · 5 comments

Comments

@mikeiasNS
Copy link

my code:
var zip = new JSZip(); zip.file('test.wav', blob); zip.generateAsync({type:"base64"}).then(function (base64) { window.location = "data:application/zip;base64," + base64; }, function (err) { console.log(err); });

@colbygk
Copy link

colbygk commented Feb 13, 2018

WAV files are a wrapper file type that can encompass different audio formats that include compression. Most likely the test.wav file is already compressed to a point where zip cannot make much headway on compressing the data any further. See: https://en.wikipedia.org/wiki/WAV

@mikeiasNS
Copy link
Author

test.wav is a recorded audio that originally was a PCM and then the wav header is added to... so, i'm sure that it is not compressed yet.

@dvdobrovolskiy
Copy link

dvdobrovolskiy commented Mar 25, 2018

zip.generateAsync({
type: "blob",
compression: "DEFLATE",
compressionOptions: {
level: 9
}
})

No?

PS with WAV no chances

@chinchang
Copy link

@dvdobrovolskiy thanks a lot! That is what actually does compression. The examples on the website just create zip and no compression at all.

@tigger0jk
Copy link

I would suggest changing the examples to default to compression, if not the API itself.

I think most users would expect creating a zip file to do compression by default, as they would when creating a zip file through something like windows or 7zip does.

With such ease of integration, I suspect many users make this same mistake and never actually check the size of the file to ensure it is compresed. Here is an example of another user who had the same issue on stack overflow: https://stackoverflow.com/questions/57866209/compressed-file-in-jszip-is-bigger-than-uncompressed-content/

I think having the examples on the website use compression would make users more likely to do what they want, and it is also more clear what is happening, since it clearly specifies that it is compresing. So if a user DOESN'T want compression they could remove or change the params.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants