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

gzip function added #567

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

gzip function added #567

wants to merge 2 commits into from

Conversation

gschadow
Copy link

@gschadow gschadow commented Nov 27, 2018

Hi, I am discussing this change here:

https://stackoverflow.com/questions/53486254/i-need-jszip-and-gzip-for-my-web-page-and-jszip-has-all-the-ingredients-but-hi

Support for gzip in JavaScript is surprisingly weak. All browsers implement it for supporting the Content-encoding: gzip header, but there is no standard access to the gzip / gunzip function of the browser. So one must use a javascript only approach. There are some old gzip-js libraries around, but they don't seem stream-enabled and 6 years out of maintenance. Then there is pako, more actively maintained, but that also doesn't seen stream enabled if using their own distribution, so you need to hold the entire binary array and the gzip output in memory. I might be wrong, but that is what I am gathering.

JSZip is a well designed tool and has support for streams "Workers". JSZip uses pako. ZIP entries are DEFLATEd and have a CRC32 checksum just like gzip, only slightly differently organized of course. Just from contemplating the JSZip sources, it looks like it could be easy to expose the gzip compression option of pako into the stream support of JSZip. And if I use both JSZip and also need gzip, why would I want to load pako twice?

So I added gzip function to JSZip and I think it would be useful for everybody.

@AdamRaichu
Copy link

Could this be updated to be compatible with the latest features? I would like to use this in my project but don't want to miss out on any new features.

@gschadow
Copy link
Author

Could this be updated to be compatible with the latest features? I would like to use this in my project but don't want to miss out on any new features.

I just stick with the old version for now because I didn't find anything worth updating. It's sad that such a simple contribution gets ignored and left behind. But it shouldn't be so hard to bring it up to date with whatever small change happened to the main code. I can't interpret this "All checks have failed" message, when I click on it I see all but the last one now has failed but there is no further information as to why. It says the log cannot be retrieved to tell us.

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

Successfully merging this pull request may close these issues.

2 participants