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

Streaming Gunzip breaks sometimes #74

Closed
manucorporat opened this issue Jun 15, 2021 · 4 comments
Closed

Streaming Gunzip breaks sometimes #74

manucorporat opened this issue Jun 15, 2021 · 4 comments

Comments

@manucorporat
Copy link
Contributor

manucorporat commented Jun 15, 2021

How to reproduce
https://codepen.io/manucorporat/pen/PopXJgb?editors=1010

Notice the:

  const step = 5141811;

With this specific value, the ungzip breaks with Error: invalid length/literal, but works with other values, higher and lower.

This variables allows to rechunk the file into smaller pieces.

This code is an example to minimally reproduce the issue, in production we got this error with random setups.

The problem
Gunzip streaming API sometimes errors.

@manucorporat
Copy link
Contributor Author

Using native Compression Streams https://chromestatus.com/feature/5855937971617792 in chrome works as expected without issues, so I expect this is an real issue

@101arrowz
Copy link
Owner

101arrowz commented Jun 15, 2021

Tested this out and I can see the issue. This is a very annoying edge case, I'll fix it in v0.7.1. Thanks for the bug report and the reproducible example.

EDIT: Just FYI, the quick workaround is to gunzip.push(chunk, chunkLength == remaining) and not push with zero length at the end.

@101arrowz
Copy link
Owner

101arrowz commented Jun 15, 2021

Should be fixed as v0.7.1. Changing the pen URL to https://cdn.jsdelivr.net/npm/fflate@0.7.1/umd/index.js fixes the bug. Let me know if it isn't resolved.

@manucorporat
Copy link
Contributor Author

Impressive! works like a charm

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

2 participants