-
Notifications
You must be signed in to change notification settings - Fork 13
Added gunzip, zlib decompression support and revamped API #9
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
Conversation
101arrowz
commented
Mar 27, 2020
@devongovett Do you think this is in scope for the project? If not, let me know, and I'll make a fork and publish my own NPM package with the changes.
101arrowz
commented
Jul 3, 2020
It's been a few months so I would like to know your opinion @devongovett. I'm currently using this PR in a project but would like to use the NPM package.
101arrowz
commented
Sep 21, 2020
I've now created my own tool fflate that is much faster than this library (and even pako), supports compression, but is about 3.5kB minified and 2kB gzipped when using tree shaking to use only the decompression API. I'll leave this PR open in case you decide to use it, but for anyone looking for a tiny compression/decompression library, I would suggest using fflate instead.
Uh oh!
There was an error while loading. Please reload this page.
I added basic support for
zlibandgzipinput (little validation - focused on performance and file size), as well as autodetection of format. This makes the API a lot easier to use for those withzlib/gzipdata. I also added JSDoc and type annotations for the methods, which allows for better autocomplete and TypeScript support.Possibly most importantly of all, I made the second parameter (the output array) optional, so that those without knowledge of the output size can still use this awesome library. It will automatically use an (admittedly inefficient) standard array to store the result of the decompression before switching to a
Uint8Array. If the data is gzipped, a header tells us the output file size, so we use that to maximize memory efficiency. The new API is still 100% compatible with the old API.Thanks for creating this wonderful library!