On this page

    Stability: 1Experimental

    Each Zstd-based class takes an options object. All options are optional.

    Attributes
    flush?:integer
    Default: zlib.constants.ZSTD_e_continue
    finishFlush?:integer
    Default: zlib.constants.ZSTD_e_end
    chunkSize?:integer
    Default: 16 * 1024
    params:Object
    Key-value object containing indexed Zstd parameters.
    maxOutputLength?:integer
    Limits output size when using convenience methods. Default: buffer.kMaxLength
    info?:boolean
    If true, returns an object with buffer and engine. Default: false
    Optional dictionary used to improve compression efficiency when compressing or decompressing data that shares common patterns with the dictionary.
    rejectGarbageAfterEnd?:boolean
    If true, decompression fails when input remains after the first complete compressed stream. Default: false

    For example:

    const stream = zlib.createZstdCompress({
      chunkSize: 32 * 1024,
      params: {
        [zlib.constants.ZSTD_c_compressionLevel]: 10,
        [zlib.constants.ZSTD_c_checksumFlag]: 1,
      },
    });