ZstdDecompressDictContext
Defined in: index.d.ts:74
Streaming zstd decompression context with dictionary.
Maintains internal decompression state across multiple transform calls,
using a pre-trained dictionary that matches the one used for compression.
maxOutputSize limits the decompressed size in bytes, 256 MB by default.
It also bounds the window that a frame makes the decoder allocate before
it writes any output: to maxOutputSize rounded up to a power of two, at
least 8 MiB and at most zstd’s default of 128 MiB, so a frame that
declares a larger window throws an error instead.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ZstdDecompressDictContext(
dict,maxOutputSize?):ZstdDecompressDictContext
Defined in: index.d.ts:1108
Parameters
Section titled “Parameters”Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>
maxOutputSize?
Section titled “maxOutputSize?”number | null
Returns
Section titled “Returns”ZstdDecompressDictContext
Methods
Section titled “Methods”[dispose]()
Section titled “[dispose]()”[dispose]():
void
Defined in: index.d.ts:76
Close the context, like close(): using declarations call it.
Returns
Section titled “Returns”void
close()
Section titled “close()”close():
void
Defined in: index.d.ts:1129
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.
Returns
Section titled “Returns”void
finish()
Section titled “finish()”finish():
Buffer
Defined in: index.d.ts:1121
Finalize the decompression stream. Returns any remaining decompressed data. Throws if the input ended before the end of a zstd frame, including empty input. Must be called once after all compressed data has been transformed.
Returns
Section titled “Returns”Buffer
finishAsync()
Section titled “finishAsync()”finishAsync():
Promise<Buffer<ArrayBufferLike>>
Defined in: index.d.ts:1172
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.
Returns
Section titled “Returns”Promise<Buffer<ArrayBufferLike>>
flush()
Section titled “flush()”flush():
Buffer
Defined in: index.d.ts:1115
Flush the decoder’s internal buffer. Returns any buffered decompressed data.
Returns
Section titled “Returns”Buffer
flushAsync()
Section titled “flushAsync()”flushAsync():
Promise<Buffer<ArrayBufferLike>>
Defined in: index.d.ts:1158
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.
Returns
Section titled “Returns”Promise<Buffer<ArrayBufferLike>>
transform()
Section titled “transform()”transform(
chunk):Buffer
Defined in: index.d.ts:1113
Decompress a chunk of compressed data. Returns decompressed output (may be empty if the decoder needs more data).
Parameters
Section titled “Parameters”Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>
Returns
Section titled “Returns”Buffer
transformAsync()
Section titled “transformAsync()”transformAsync(
chunk):Promise<Buffer<ArrayBufferLike>>
Defined in: index.d.ts:1146
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.
Parameters
Section titled “Parameters”Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>
Returns
Section titled “Returns”Promise<Buffer<ArrayBufferLike>>