@ -103,159 +103,6 @@ tradeoffs involved in zlib usage.
}
}).listen(1337);
## zlib.createGzip([options])
Returns a new [Gzip ](#zlib_class_zlib_gzip ) object with an
[options ](#zlib_options ).
## zlib.createGunzip([options])
Returns a new [Gunzip ](#zlib_class_zlib_gunzip ) object with an
[options ](#zlib_options ).
## zlib.createDeflate([options])
Returns a new [Deflate ](#zlib_class_zlib_deflate ) object with an
[options ](#zlib_options ).
## zlib.createInflate([options])
Returns a new [Inflate ](#zlib_class_zlib_inflate ) object with an
[options ](#zlib_options ).
## zlib.createDeflateRaw([options])
Returns a new [DeflateRaw ](#zlib_class_zlib_deflateraw ) object with an
[options ](#zlib_options ).
## zlib.createInflateRaw([options])
Returns a new [InflateRaw ](#zlib_class_zlib_inflateraw ) object with an
[options ](#zlib_options ).
## zlib.createUnzip([options])
Returns a new [Unzip ](#zlib_class_zlib_unzip ) object with an
[options ](#zlib_options ).
## Class: zlib.Zlib
Not exported by the `zlib` module. It is documented here because it is the base
class of the compressor/decompressor classes.
### zlib.flush([kind], callback)
`kind` defaults to `zlib.Z_FULL_FLUSH` .
Flush pending data. Don't call this frivolously, premature flushes negatively
impact the effectiveness of the compression algorithm.
### zlib.params(level, strategy, callback)
Dynamically update the compression level and compression strategy.
Only applicable to deflate algorithm.
### zlib.reset()
Reset the compressor/decompressor to factory defaults. Only applicable to
the inflate and deflate algorithms.
## Class: zlib.Gzip
Compress data using gzip.
## Class: zlib.Gunzip
Decompress a gzip stream.
## Class: zlib.Deflate
Compress data using deflate.
## Class: zlib.Inflate
Decompress a deflate stream.
## Class: zlib.DeflateRaw
Compress data using deflate, and do not append a zlib header.
## Class: zlib.InflateRaw
Decompress a raw deflate stream.
## Class: zlib.Unzip
Decompress either a Gzip- or Deflate-compressed stream by auto-detecting
the header.
## Convenience Methods
<!-- type=misc -->
All of these take a string or buffer as the first argument, an optional second
argument to supply options to the zlib classes and will call the supplied
callback with `callback(error, result)` .
Every method has a `*Sync` counterpart, which accept the same arguments, but
without a callback.
## zlib.deflate(buf[, options], callback)
## zlib.deflateSync(buf[, options])
Compress a string with Deflate.
## zlib.deflateRaw(buf[, options], callback)
## zlib.deflateRawSync(buf[, options])
Compress a string with DeflateRaw.
## zlib.gzip(buf[, options], callback)
## zlib.gzipSync(buf[, options])
Compress a string with Gzip.
## zlib.gunzip(buf[, options], callback)
## zlib.gunzipSync(buf[, options])
Decompress a raw Buffer with Gunzip.
## zlib.inflate(buf[, options], callback)
## zlib.inflateSync(buf[, options])
Decompress a raw Buffer with Inflate.
## zlib.inflateRaw(buf[, options], callback)
## zlib.inflateRawSync(buf[, options])
Decompress a raw Buffer with InflateRaw.
## zlib.unzip(buf[, options], callback)
## zlib.unzipSync(buf[, options])
Decompress a raw Buffer with Unzip.
## Options
<!-- type=misc -->
Each class takes an options object. All options are optional.
Note that some options are only relevant when compressing, and are
ignored by the decompression classes.
* flush (default: `zlib.Z_NO_FLUSH` )
* chunkSize (default: 16*1024)
* windowBits
* level (compression only)
* memLevel (compression only)
* strategy (compression only)
* dictionary (deflate/inflate only, empty dictionary by default)
See the description of `deflateInit2` and `inflateInit2` at
< http: / / zlib . net / manual . html # Advanced > for more information on these.
## Memory Usage Tuning
<!-- type=misc -->
@ -361,3 +208,161 @@ The deflate compression method (the only one supported in this version).
For initializing zalloc, zfree, opaque.
* `zlib.Z_NULL`
## Class Options
<!-- type=misc -->
Each class takes an options object. All options are optional.
Note that some options are only relevant when compressing, and are
ignored by the decompression classes.
* flush (default: `zlib.Z_NO_FLUSH` )
* chunkSize (default: 16*1024)
* windowBits
* level (compression only)
* memLevel (compression only)
* strategy (compression only)
* dictionary (deflate/inflate only, empty dictionary by default)
See the description of `deflateInit2` and `inflateInit2` at
< http: / / zlib . net / manual . html # Advanced > for more information on these.
## Class: zlib.Deflate
Compress data using deflate.
## Class: zlib.DeflateRaw
Compress data using deflate, and do not append a zlib header.
## Class: zlib.Gunzip
Decompress a gzip stream.
## Class: zlib.Gzip
Compress data using gzip.
## Class: zlib.Inflate
Decompress a deflate stream.
## Class: zlib.InflateRaw
Decompress a raw deflate stream.
## Class: zlib.Unzip
Decompress either a Gzip- or Deflate-compressed stream by auto-detecting
the header.
## Class: zlib.Zlib
Not exported by the `zlib` module. It is documented here because it is the base
class of the compressor/decompressor classes.
### zlib.flush([kind], callback)
`kind` defaults to `zlib.Z_FULL_FLUSH` .
Flush pending data. Don't call this frivolously, premature flushes negatively
impact the effectiveness of the compression algorithm.
### zlib.params(level, strategy, callback)
Dynamically update the compression level and compression strategy.
Only applicable to deflate algorithm.
### zlib.reset()
Reset the compressor/decompressor to factory defaults. Only applicable to
the inflate and deflate algorithms.
## zlib.createDeflate([options])
Returns a new [Deflate ](#zlib_class_zlib_deflate ) object with an
[options ](#zlib_options ).
## zlib.createDeflateRaw([options])
Returns a new [DeflateRaw ](#zlib_class_zlib_deflateraw ) object with an
[options ](#zlib_options ).
## zlib.createGunzip([options])
Returns a new [Gunzip ](#zlib_class_zlib_gunzip ) object with an
[options ](#zlib_options ).
## zlib.createGzip([options])
Returns a new [Gzip ](#zlib_class_zlib_gzip ) object with an
[options ](#zlib_options ).
## zlib.createInflate([options])
Returns a new [Inflate ](#zlib_class_zlib_inflate ) object with an
[options ](#zlib_options ).
## zlib.createInflateRaw([options])
Returns a new [InflateRaw ](#zlib_class_zlib_inflateraw ) object with an
[options ](#zlib_options ).
## zlib.createUnzip([options])
Returns a new [Unzip ](#zlib_class_zlib_unzip ) object with an
[options ](#zlib_options ).
## Convenience Methods
<!-- type=misc -->
All of these take a string or buffer as the first argument, an optional second
argument to supply options to the zlib classes and will call the supplied
callback with `callback(error, result)` .
Every method has a `*Sync` counterpart, which accept the same arguments, but
without a callback.
### zlib.deflate(buf[, options], callback)
Compress a string with Deflate.
### zlib.deflateRaw(buf[, options], callback)
### zlib.deflateRawSync(buf[, options])
Compress a string with DeflateRaw.
### zlib.deflateSync(buf[, options])
Compress a string with Deflate.
### zlib.gunzip(buf[, options], callback)
### zlib.gunzipSync(buf[, options])
Decompress a raw Buffer with Gunzip.
### zlib.gzip(buf[, options], callback)
### zlib.gzipSync(buf[, options])
Compress a string with Gzip.
### zlib.inflate(buf[, options], callback)
Decompress a raw Buffer with Inflate.
### zlib.inflateRaw(buf[, options], callback)
### zlib.inflateRawSync(buf[, options])
Decompress a raw Buffer with InflateRaw.
### zlib.inflateSync(buf[, options])
Decompress a raw Buffer with Inflate.
### zlib.unzip(buf[, options], callback)
### zlib.unzipSync(buf[, options])
Decompress a raw Buffer with Unzip.