Skip to content

Need help to use fflate for decompressing a local database asynchronously #215

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

You must be logged in to vote

There isn't really an inflate-only CDN. I've been waiting for a while for a CDN service to offer the ability to tree-shake based on the function names specified in a query parameter or something to offer exactly that kind of functionality, but unfortunately I don't think it exists; you'll probably have to use the 11kB minzipped CDN bundle. You can do that by adding the HTML provided in the README to your page:

<script src="https://cdn.jsdelivr.net/npm/fflate@0.8.2/umd/index.js"></script>

Beyond that, to make your above code use fflate and not hang the page, all you'd change is the decompressedBuffer line.

const decompressedBuffer = await new Promise((resolve, reject) => {
  fflate.inflate(b…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by 101arrowz
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