类:ZstdOptions


¥Class: ZstdOptions

稳定性: 1 - 实验性的

¥Stability: 1 - Experimental

每个基于 Zstd 的类都采用一个 options 对象。所有选项都是可选的。

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

  • flush <integer> 默认值:zlib.constants.ZSTD_e_continue

    ¥flush <integer> Default: zlib.constants.ZSTD_e_continue

  • finishFlush <integer> 默认值:zlib.constants.ZSTD_e_end

    ¥finishFlush <integer> Default: zlib.constants.ZSTD_e_end

  • chunkSize <integer> 默认值:16 * 1024

    ¥chunkSize <integer> Default: 16 * 1024

  • params <Object> 包含索引 Zstd 参数 的键值对象。

    ¥params <Object> Key-value object containing indexed Zstd parameters.

  • maxOutputLength <integer> 使用 方便的方法 时限制输出大小。默认值:buffer.kMaxLength

    ¥maxOutputLength <integer> Limits output size when using convenience methods. Default: buffer.kMaxLength

  • info <boolean> 如果是 true,则返回一个包含 bufferengine 的对象。默认值:false

    ¥info <boolean> If true, returns an object with buffer and engine. Default: false

  • dictionary <Buffer> 可选字典,用于在压缩或解压与字典共享常见模式的数据时提高压缩效率。

    ¥dictionary <Buffer> Optional dictionary used to improve compression efficiency when compressing or decompressing data that shares common patterns with the dictionary.

例如:

¥For example:

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