Skip to content

Documentation

abal edited this page Oct 23, 2017 · 1 revision

zlib-sync Documentation

Class: ZlibSync.Inflate

A generic wrapper for decompressing a stream of inflated or gzipped data.

new Inflate([options])

  • options {Object}
    • chunkSize {Number} - The size of each interally generated data chunk
    • to {String} - If "string", result will be a string. Otherwise, result will be a Buffer.
    • windowBits {Number} - The base two logarithm of the window size. See the zlib documentation for more information

Inflate.err -> {Number}

The error code after finishing an inflate. This should be checked before grabbing the inflate result.

Inflate.msg -> {String}

The error message, null if Inflate.err == 0.

Inflate.result -> {Buffer | String}

The decompressed result, containing the result for all pushed chunks since the last flush.

Inflate.push(data[, flush])

  • data {Buffer | Uint8Array} - Input data
  • mode {Boolean | Number} - The flush mode to use. Can be a number 0..6 corresponding to a flush constant, true for Z_FINISH, or Z_NO_FLUSH otherwise

Inflates a chunk of input data. The last data chunk must have flush set to Z_FINISH to flush data from internal zlib buffers. For mid-stream flushes, Z_SYNC_FLUSH will flush existing data but keep the inflate context.