Module

x/zipjs/index.d.ts>Configuration

JavaScript library to zip and unzip files supporting multi-core compression, compression streams, zip64, split files and encryption.
Latest
interface Configuration
import { type Configuration } from "https://dotland.deno.dev/x/zipjs@v2.7.53/index.d.ts";

Represents the configuration passed to configure.

Properties

optional
maxWorkers: number

The maximum number of web workers used to compress/decompress data simultaneously.

optional
terminateWorkerTimeout: number

The delay in milliseconds before idle web workers are automatically terminated. You can call terminateWorkers() to terminate idle workers.

optional
workerScripts: { deflate?: string[]; inflate?: string[]; }

The 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"]
  }
});
optional
chunkSize: number

The size of the chunks in bytes during data compression/decompression.

optional
Deflate: ZipDeflate

The codec implementation used to compress data.

optional
Inflate: ZipInflate

The codec implementation used to decompress data.

optional
CompressionStream: TransformStreamLike

The stream implementation used to compress data when useCompressionStream is set to false.

optional
DecompressionStream: TransformStreamLike

The stream implementation used to decompress data when useCompressionStream is set to false.