Optional
level?: -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9The compression level to use. Must be between -1
and 9
.
-1
uses the default compression level (Currently 6
)0
gives no compression1
gives least compression, fastest speed9
gives best compression, slowest speedOptional
memHow much memory should be allocated for the internal compression state.
A value of 1
uses minimum memory but is slow and reduces compression ratio.
A value of 9
uses maximum memory for optimal speed. The default is 8
.
Optional
strategy?: numberTunes the compression algorithm.
Z_DEFAULT_STRATEGY
: For normal data (Default)Z_FILTERED
: For data produced by a filter or predictorZ_HUFFMAN_ONLY
: Force Huffman encoding only (no string match)Z_RLE
: Limit match distances to one (run-length encoding)Z_FIXED
prevents the use of dynamic Huffman codesZ_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.
Optional
windowThe base 2 logarithm of the window size (the size of the history buffer).
Larger values of this parameter result in better compression at the expense of memory usage.
The following value ranges are supported:
9..15
: The output will have a zlib header and footer (Deflate)-9..-15
: The output will not have a zlib header or footer (Raw Deflate)25..31
(16+9..15
): The output will have a gzip header and footer (gzip)The gzip header will have no file name, no extra data, no comment, no modification time (set to zero) and no header CRC.
Generated using TypeDoc
Compression options for
Bun.deflateSync
andBun.gzipSync