zstd-napi - v0.0.11
    Preparing search index...

    Class DCtx

    Decompression context.

    Wraps ZSTD_DCtx (which is also ZSTD_DStream). The finalizer automatically calls ZSTD_freeDCtx when this object is garbage collected.

    Index

    Constructors

    Methods

    • Decompresses srcBuf into dstBuf.

      dstBuf must be large enough to fit the entire result. srcBuf must end on a frame boundary (no partial frames or other trailing data).

      Wraps ZSTD_decompressDCtx.

      Parameters

      • dstBuf: Uint8Array

        Output buffer for decompressed bytes

      • srcBuf: Uint8Array

        Data to decompress

      Returns number

      Number of decompressed bytes written to dstBuf

      If the frame has the uncompressed size in the header, you can use getFrameContentSize to determine how big the buffer needs to be. If it's too large, or unknown, use decompressStream instead.

    • Decompresses srcBuf into dstBuf with a streaming interface.

      May consume all or part of srcBuf, and may partially write dstBuf. Returns a tuple with a bound on how many bytes are left to flush, how many bytes were written, and how many bytes were consumed.

      Wraps ZSTD_decompressStream.

      Parameters

      • dstBuf: Uint8Array

        Output buffer for decompressed bytes

      • srcBuf: Uint8Array

        Data to decompress

      Returns StreamResult

      Decompression progress information

      This function requires some care to use correctly, consult the Zstandard manual for full usage information.

    • Decompresses srcBuf into dstBuf using the prepared dictionary dict.

      Works like decompress, except it uses the provided dictionary instead of any set on this context.

      Wraps ZSTD_decompress_usingDDict.

      Parameters

      • dstBuf: Uint8Array

        Output buffer for compressed bytes

      • srcBuf: Uint8Array

        Data to compress

      • dict: DDict

        Prepared dictionary

      Returns number

      Number of compressed bytes written to dstBuf

    • Decompresses srcBuf into dstBuf, using dictBuf as a dictionary.

      Works like decompress, except it uses the provided dictionary instead of any set on this context.

      Wraps ZSTD_decompress_usingDict.

      Parameters

      • dstBuf: Uint8Array

        Output buffer for decompressed bytes

      • srcBuf: Uint8Array

        Data to decompress

      • dictBuf: Uint8Array

        Compression dictionary

      Returns number

      Number of compressed bytes written to dstBuf

      Loading the dictionary from a buffer is expensive. If the dictionary will be used more than once, it's better to load it into a DDict once and use decompressUsingDDict instead.

    • Load a compression dictionary from dictBuf.

      This dictionary will be used by decompress and decompressStream.

      Wraps ZSTD_DCtx_loadDictionary.

      Parameters

      • dictBuf: Uint8Array

      Returns void

    • Set a decompression parameter.

      Wraps ZSTD_DCtx_setParameter.

      Parameters

      • param: windowLogMax

        Parameter to set

      • value: number

        New parameter value

      Returns void