Skip to content

DeflateDecompressContext

Defined in: index.d.ts:34

Streaming raw deflate decompression context.

Maintains internal decompression state across multiple transform calls, enabling chunked decompression of a raw deflate stream.

new DeflateDecompressContext(maxOutputSize?): DeflateDecompressContext

Defined in: index.d.ts:484

number | null

DeflateDecompressContext

[dispose](): void

Defined in: index.d.ts:36

Close the context, like close(): using declarations call it.

void


close(): void

Defined in: index.d.ts:505

Release the native state of the context now rather than when the context is garbage-collected. Later calls throw, and finish() releases the state too. Closing a finished or closed context does nothing. [Symbol.dispose]() is the same method, for using declarations.

void


finish(): Buffer

Defined in: index.d.ts:497

Finalize the deflate decompression stream. Throws if the input ended before the final deflate block, including empty input. Must be called once after all compressed data has been transformed.

Buffer


finishAsync(): Promise<Buffer<ArrayBufferLike>>

Defined in: index.d.ts:548

finish() on the libuv thread pool: returns a Promise of the rest of the output, and reports every error by rejecting it. The native state is released once the call has run, whether it succeeded or not. In the browser build, it runs synchronously, on the calling thread.

At most one asynchronous call may be in flight per context: until its Promise settles, another asynchronous call rejects and a synchronous call throws <name> is busy: an asynchronous call has not finished. After close(), calls reject with <name> already closed.

Promise<Buffer<ArrayBufferLike>>


flush(): Buffer

Defined in: index.d.ts:491

Flush the decoder’s internal buffer. Returns any buffered decompressed data.

Buffer


flushAsync(): Promise<Buffer<ArrayBufferLike>>

Defined in: index.d.ts:534

flush() on the libuv thread pool: returns a Promise of the output, and reports every error by rejecting it. In the browser build, it runs synchronously, on the calling thread.

At most one asynchronous call may be in flight per context: until its Promise settles, another asynchronous call rejects and a synchronous call throws <name> is busy: an asynchronous call has not finished. After close(), calls reject with <name> already closed.

Promise<Buffer<ArrayBufferLike>>


transform(chunk): Buffer

Defined in: index.d.ts:489

Decompress a chunk of compressed data. Returns decompressed output (may be empty if the decoder needs more data).

Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>

Buffer


transformAsync(chunk): Promise<Buffer<ArrayBufferLike>>

Defined in: index.d.ts:522

transform(chunk) on the libuv thread pool: returns a Promise of the output, and reports every error, an invalid argument included, by rejecting it. The chunk is copied before the method returns, so the caller may reuse its memory at once. In the browser build, it runs synchronously, on the calling thread.

At most one asynchronous call may be in flight per context: until its Promise settles, another asynchronous call rejects and a synchronous call throws <name> is busy: an asynchronous call has not finished, such as zstd stream is busy: an asynchronous call has not finished. close() while a call is in flight releases the native state once the call settles, and its Promise still settles. After close(), calls reject with <name> already closed.

Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>

Promise<Buffer<ArrayBufferLike>>