Skip to content

How to get AsyncGzip working with modern browser demo #117

Answered by 101arrowz
juanbill asked this question in Q&A
Discussion options

You must be logged in to vote

First of all, you should pick between AsyncGzip and AsyncDeflate based on your need. Gzip is a lightweight wrapper around DEFLATE with some header information and a CRC. You can usually decompress a Gzip file with standard tools, but DEFLATE is a bit harder. If you have a choice, I would go with Gzip unless you're doing regularly doing files under a kilobyte.

To adapt the code to handle a single uploaded file, you can use this change:

// Install this: https://github.com/jimmywarting/StreamSaver.js
// Or do this:
import streamSaver from 'https://cdn.skypack.dev/streamsaver';
// Promise.all for parallelism
const handleFiles = fileArray => Promise.all(fileArray.map(async file => {
  const gzip 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@juanbill
Comment options

Answer selected by juanbill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants