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

Cannot unzip files larger than 200MB #18

Open
mvallet91 opened this issue Jan 4, 2021 · 1 comment
Open

Cannot unzip files larger than 200MB #18

mvallet91 opened this issue Jan 4, 2021 · 1 comment

Comments

@mvallet91
Copy link
Owner

When uploading files larger than 200MB (zipped) the browser cannot allocate the required memory for inflating using pako. It returns the following error:

RangeError: Array buffer allocation failed
    at new ArrayBuffer (<anonymous>)
    at new Uint8Array (<anonymous>)
    at Object.flattenChunks (pako.js:892)
    at Inflate.onEnd (pako.js:738)
    at Inflate.push (pako.js:690)
    at Object.inflate (pako.js:789)
    at FileReader.reader.onload (index.js:201)

Currently, we inflate the whole file (pako), decode it (TextDecode), and then chunk it for processing. This needs to be refactored, some ideas:

  • Inflate only the required chunk with pako, then decode and process
  • Try a different library to inflate the gzip chunks, like (jszip
@mvallet91
Copy link
Owner Author

The error was caused because browsers have a 2^32 size limit for unsigned arrays, required for all decompression libraries, and the 2.1GB reaches that, according to developers of fflate .

Currently evaluating fflate, in final stages of testing. Looks like it runs faster and with less memory use, since it decompresses in streaming instead of decompressing the whole file.

@mvallet91 mvallet91 mentioned this issue Jan 14, 2021
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