Skip to content

DecompressOptions

Defined in: next/api.d.ts:152

The options of decompress and decompressSync. Other properties are ignored. F is the formats that the entry point includes, as for CompressOptions.

F extends Format = Format

optional dictionary?: Dictionary | Input

Defined in: next/api.d.ts:188

The dictionary that the data was compressed with, for zstd and brotli only: a Dictionary, or the same bytes, whatever compression took. Bytes need a format: with 'auto', decompression fails with ERR_COMPRS_INVALID_ARG.


optional format?: F | "auto"

Defined in: next/api.d.ts:163

The format of the data, or 'auto', the default, to detect it from the data. Detection recognizes zstd, gzip, deflate (zlib), brotli and lz4, but never deflate-raw, which has no header to recognize. Brotli data has no magic number, so detection guesses it, and data that it takes for brotli but that does not decode fails with ERR_COMPRS_UNKNOWN_FORMAT.

With a Dictionary as the dictionary, 'auto' stands for the format of the dictionary instead.


optional maxOutputSize?: number

Defined in: next/api.d.ts:181

The largest output, in bytes: an integer from 0 to Number.MAX_SAFE_INTEGER, 268435456 (256 MiB) by default. Output that would be larger fails with ERR_COMPRS_SIZE_LIMIT.

The limit also bounds the memory of the zstd decoder: under a limit of 64 MiB or less, a zstd frame that declares a window larger than the limit, rounded up to a power of two and never less than 8 MiB, fails with ERR_COMPRS_SIZE_LIMIT too. zstd writes no larger window at levels up to 19, so the frames that compress writes at those levels decode under any limit that their output fits in.

In the browser build, limits above 4294967295 (4 GiB - 1) act as 4294967295, since WebAssembly memory cannot hold more: errors name that limit, and a zstd frame that declares a larger content size fails with ERR_COMPRS_SIZE_LIMIT.