BrotliOptions
History
Added in: v11.7.0
v11.7.0
Introduced in: v0.10.0
v0.10.0
The
rejectGarbageAfterEnd option was added.v26.5.0
The
maxOutputLength option is supported now.v14.5.0, v12.19.0
Each Brotli-based class takes an options object. All options are optional.
Attributes
flush?:
integerDefault:
zlib.constants.BROTLI_OPERATION_PROCESSfinishFlush?:
integerDefault:
zlib.constants.BROTLI_OPERATION_FINISHchunkSize?:
integerDefault:
16 * 1024params:
ObjectKey-value object containing indexed Brotli parameters.
maxOutputLength?:
integerLimits output size when using
convenience methods. Default:
buffer.kMaxLengthinfo?:
booleanIf
true, returns an object with buffer and engine. Default: falserejectGarbageAfterEnd?:
booleanIf
true, decompression fails when
input remains after the first complete compressed stream. Default: falseFor example:
const stream = zlib.createBrotliCompress({ chunkSize: 32 * 1024, params: { [zlib.constants.BROTLI_PARAM_MODE]: zlib.constants.BROTLI_MODE_TEXT, [zlib.constants.BROTLI_PARAM_QUALITY]: 4, [zlib.constants.BROTLI_PARAM_SIZE_HINT]: fs.statSync(inputFile).size, }, });