jszip icon indicating copy to clipboard operation
jszip copied to clipboard

gzip function added

Open gschadow opened this issue 6 years ago • 2 comments

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.

gschadow avatar Nov 27 '18 21:11 gschadow

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.

AdamRaichu avatar Jan 25 '23 22:01 AdamRaichu

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.

gschadow avatar Jan 26 '23 15:01 gschadow