png-compressor
    Preparing search index...

    Function Deflate

    • new Deflate(options)

      • options (Object): zlib 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 deflate
      • gzip (Boolean) - create gzip wrapper
      • header (Object) - custom header for gzip
        • text (Boolean) - true if compressed data believed to be text
        • time (Number) - modification time, unix timestamp
        • os (Number) - operation system code
        • extra (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 added
      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 chunk

      if (deflate.err) { throw new Error(deflate.err); }

      console.log(deflate.result);

      Parameters

      • options: any

      Returns void