pako - zlib port to javascript, very fast!
 
 
 
Go to file
Vitaly Puzrin 1c008e7901 updated ignore masks 2014-02-24 06:17:00 +04:00
benchmark use level 6 for deflate profiling 2014-02-19 17:43:07 +04:00
lib added coverage generation & improved tests 2014-02-21 19:06:31 +04:00
test added coverage generation & improved tests 2014-02-21 19:06:31 +04:00
.gitignore updated ignore masks 2014-02-24 06:17:00 +04:00
.jshintignore added coverage generation & improved tests 2014-02-21 19:06:31 +04:00
.jshintrc implement deflate store + high level deflate implementation + lint fixes 2014-02-13 14:55:24 -02:00
.ndocrc Added generated API docs 2014-02-20 01:38:10 +04:00
.npmignore updated ignore masks 2014-02-24 06:17:00 +04:00
.travis.yml
LICENSE readme & license 2014-02-18 21:55:32 +04:00
Makefile added coverage generation & improved tests 2014-02-21 19:06:31 +04:00
README.md readme update - shortened intro 2014-02-20 16:49:08 +04:00
index.js
package.json Improved test suite 2014-02-18 23:15:27 +04:00

README.md

pako - zlib port to javascript, very fast!

Build Status

Why pako is cool:

  • Almost as fast in modern browsers as C implementation (see benchmarks).
  • Works in browser, you can browserify any separate component.
  • Both Sync & streamable (for big blobs) interfaces.
  • It's fresh - ports the latest zlib version (now 1.2.8), results are binary equal.

Benchmarks:

node v0.10, 10mb sample:

   deflate-gildas x 4.62 ops/sec ±1.93% (15 runs sampled)
   deflate-imaya x 3.82 ops/sec ±1.31% (13 runs sampled)
 ! deflate-pako x 9.09 ops/sec ±0.42% (26 runs sampled)
   deflate-zlib x 14.16 ops/sec ±3.33% (63 runs sampled)

node v0.11, 10mb sample:

   deflate-gildas x 5.10 ops/sec ±4.94% (16 runs sampled)
   deflate-imaya x 3.42 ops/sec ±4.11% (12 runs sampled)
 ! deflate-pako x 11.28 ops/sec ±0.42% (32 runs sampled)
   deflate-zlib x 14.17 ops/sec ±3.34% (64 runs sampled)

Install:

node.js:

npm install pako

browser:

bower install pako

Example & API

Full docs.

var pako = require('pako');

// Deflate
//
var input = new Uint8Array();
//... fill input data here
var output = pako.deflate(input);

// Inflate
//
var compressed = new Uint8Array();
//... fill data to uncompress here
var result = pako.inflate(compressed);
if (result.err) {
  console.log(result.err, result.msg);
}
var uncompressed = result.data;

Notes

Pako does not contains some very specific zlib functions.

  • deflate - writing bustom gzip headers and methods deflateSetDictionary, deflateParams, deflateSetHeader, deflateBound, deflatePending.
  • inflate - TBD.

Authors

Personal thanks to Vyacheslav Egorov (@mraleph) for his awesome tutoruals about optimising JS code for v8, IRHydra tool and his advices.

License

MIT