On this page

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

    Attributes
    flush?:integer
    Default: zlib.constants.BROTLI_OPERATION_PROCESS
    finishFlush?:integer
    Default: zlib.constants.BROTLI_OPERATION_FINISH
    chunkSize?:integer
    Default: 16 * 1024
    params:Object
    Key-value object containing indexed Brotli 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
    rejectGarbageAfterEnd?:boolean
    If true, decompression fails when input remains after the first complete compressed stream. Default: false

    For 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,
      },
    });