Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
101arrowz wants to merge 1 commit into foliojs:master
base: master
Choose a base branch
Loading
from 101arrowz:master

Conversation

@101arrowz
Copy link

@101arrowz 101arrowz commented Mar 26, 2020
edited
Loading

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!

autarc reacted with thumbs up emoji
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.

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.

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.

autarc reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /