property

ZlibCompressionOptions.strategy

strategy?: number

Tunes the compression algorithm. One of these constants of node:zlib; any other value throws.

  • Z_DEFAULT_STRATEGY (0): For normal data (Default)
  • Z_FILTERED (1): For data produced by a filter or predictor
  • Z_HUFFMAN_ONLY (2): Force Huffman encoding only (no string match)
  • Z_RLE (3): Limit match distances to one (run-length encoding)
  • Z_FIXED (4): Prevents the use of dynamic Huffman codes

Z_RLE is designed to be almost as fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data.

Z_FILTERED forces more Huffman coding and less string matching; it is somewhat intermediate between Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Filtered data consists mostly of small values with a somewhat random distribution.