Optional
chunkThe size of the chunks in bytes during data compression/decompression.
Optional
CompressionThe stream implementation used to compress data when useCompressionStream
is set to false
.
Optional
DecompressionThe stream implementation used to decompress data when useCompressionStream
is set to false
.
Optional
DeflateThe codec implementation used to compress data.
Optional
InflateThe codec implementation used to decompress data.
Optional
maxThe maximum number of web workers used to compress/decompress data simultaneously.
Optional
terminateThe delay in milliseconds before idle web workers are automatically terminated. You can call terminateWorkers()
to terminate idle workers.
Optional
usetrue
to use the native API CompressionStream
/DecompressionStream
to compress/decompress data.
Optional
usetrue
to use web workers to compress/decompress data in non-blocking background processes.
Optional
workerThe URIs of the compression/decompression scripts run in web workers.
It allows using alternative deflate implementations or specifying a URL to the worker script if the CSP of the page blocks scripts imported from a Blob URI.
The properties deflate
and inflate
must specify arrays of URLs to import the deflate/inflate web workers, respectively.
The first URL is relative to the base URI of the document. The other URLs are relative to the URL of the first script. Scripts in the array are executed in order.
If you only use deflation or inflation, the unused deflate
/inflate
property can be omitted.
Here is an example:
configure({
workerScripts: {
deflate: ["library_path/custom-worker.js", "./custom-deflate.js"],
inflate: ["library_path/custom-worker.js", "./custom-inflate.js"]
}
});
If the CSP of the page blocks scripts imported from a Blob URI you can use z-worker.js
from https://github.com/gildas-lormeau/zip.js/tree/master/dist and specify the URL where it can be found.
Here is an example:
configure({
workerScripts: {
deflate: ["library_path/z-worker.js"],
inflate: ["library_path/z-worker.js"]
}
});
Represents the configuration passed to configure.