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

Use zlib.createUnzip() #10

Open
piranna opened this issue Jun 3, 2023 · 1 comment
Open

Use zlib.createUnzip() #10

piranna opened this issue Jun 3, 2023 · 1 comment

Comments

@piranna
Copy link

piranna commented Jun 3, 2023

gunzip-maybe/index.js

Lines 19 to 28 in 6903d9c

switch (isCompressed(data)) {
case 1:
swap(null, pumpify(zlib.createGunzip(), gunzip(maxRecursion - 1)))
break
case 2:
swap(null, pumpify(zlib.createInflate(), gunzip(maxRecursion - 1)))
break
default:
swap(null, through())
}

It looks like createUnzip() already does detection between Gunzip and Inflate, so there's no need to do it ourselves, reducing code size and number of dependencies.

@piranna
Copy link
Author

piranna commented Jun 3, 2023

Also, since this project is not just Gunzip-only anymore, maybe should it be renamed to unzip-maybe? :-)

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

No branches or pull requests

1 participant