Skip to content

Web Workers throws a CSP error - could we disable them? #205

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

You must be logged in to vote

To clarify, fflate offers two ZIP functions: zipSync and zip. zipSync runs synchronously and without any Web Workers. zip runs asynchronously and uses Web Workers. There is no reason to run zip in an environment that does not support blob-based Web Workers; the only reason you'd use it instead of zipSync is to take advantage of multicore compression using worker threads. The way to disable Web Workers is simply to use zipSync instead.

I'd like to keep using zip but provide a way to users of my lib to disable Web Worker if they want with just an option.

I recommend just conditionally using zip or zipSync based on the user options. Having two implementations is not as convoluted as it see…

Replies: 1 comment 1 reply

Comment options

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

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