new Deflate(options)
Creates new deflator instance with specified params. Throws exception on bad params. Supported options:
level
windowBits
memLevel
strategy
dictionary
http://zlib.net/manual.html#Advanced for more information on these.
Additional options, for internal needs:
chunkSize
raw
gzip
header
text
time
os
extra
name
comment
hcrc
const pako = require('pako') , chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9]) , chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);const deflate = new pako.Deflate({ level: 3});deflate.push(chunk1, false);deflate.push(chunk2, true); // true -> last chunkif (deflate.err) { throw new Error(deflate.err); }console.log(deflate.result); Copy
const pako = require('pako') , chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9]) , chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);const deflate = new pako.Deflate({ level: 3});deflate.push(chunk1, false);deflate.push(chunk2, true); // true -> last chunkif (deflate.err) { throw new Error(deflate.err); }console.log(deflate.result);
new Deflate(options)
Creates new deflator instance with specified params. Throws exception on bad params. Supported options:
level
windowBits
memLevel
strategy
dictionary
http://zlib.net/manual.html#Advanced for more information on these.
Additional options, for internal needs:
chunkSize
- size of generated data chunks (16K by default)raw
(Boolean) - do raw deflategzip
(Boolean) - create gzip wrapperheader
(Object) - custom header for gziptext
(Boolean) - true if compressed data believed to be texttime
(Number) - modification time, unix timestampos
(Number) - operation system codeextra
(Array) - array of bytes with extra data (max 65536)name
(String) - file name (binary string)comment
(String) - comment (binary string)hcrc
(Boolean) - true if header crc should be addedExample: