Skip to content

zstdDecompressWithCapacityAsync

zstdDecompressWithCapacityAsync(data, capacity): Promise<Buffer<ArrayBufferLike>>

Defined in: index.d.ts:1747

Asynchronously decompress Zstandard-compressed data with explicit capacity.

Use this when the decompressed size exceeds the default 256 MB limit. The capacity parameter specifies the maximum decompressed size in bytes. It is only a limit: the output buffer grows with the decompressed data, so a large capacity reserves no memory up front. capacity also bounds the window that a frame makes the decoder allocate before it writes any output: to capacity rounded up to a power of two, at least 8 MiB and at most zstd’s default of 128 MiB, so for a frame that declares a larger window the promise rejects with an error instead.

Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>

number

Promise<Buffer<ArrayBufferLike>>