Skip to content

createBrotliCompressDictStream

createBrotliCompressDictStream(dict, quality?): TransformStream<ArrayBufferLike | ArrayBufferView<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>

Defined in: streams.d.ts:125

Create a streaming brotli compression TransformStream with a custom dictionary.

Uses the Web Streams API (TransformStream) to provide chunked compression with a custom dictionary for improved compression of similar data. It holds up to the first 4 MiB less 16 bytes (4,194,288 bytes) of the input, and compresses an input that ends there into the output of brotliCompressWithDict(). Past them, the stream emits compressed output as the input arrives, still with the dictionary.

Input chunks may be any ArrayBuffer, SharedArrayBuffer or ArrayBufferView, read byte for byte: a Uint16Array is not converted element by element.

Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>

Custom dictionary bytes.

number

Compression quality (0-11). Default is 6.

TransformStream<ArrayBufferLike | ArrayBufferView<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>