Skip to content

Conversation

@101arrowz
Copy link

@101arrowz 101arrowz commented Mar 26, 2020

I added basic support for zlib and gzip input (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 with zlib/gzip data. 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!

@101arrowz
Copy link
Author

@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
Copy link
Author

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
Copy link
Author

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.

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.

1 participant