pako/README.md

102 wiersze
2.2 KiB
Markdown
Czysty Zwykły widok Historia

2014-02-18 22:10:11 +00:00
pako - zlib port to javascript, very fast!
==========================================
2014-01-25 13:57:00 +00:00
2014-02-13 17:29:55 +00:00
[![Build Status](https://travis-ci.org/nodeca/pako.png?branch=master)](https://travis-ci.org/nodeca/pako)
2014-02-18 17:55:32 +00:00
__Why pako is cool:__
2014-02-18 22:10:11 +00:00
- Almost as fast in modern browsers as C implementation (see benchmarks)
2014-02-18 17:55:32 +00:00
- Works in browser
- Modular - you can browserify any separate component
- Both Sync & streamable interfaces (streamable is for big blobs)
- It's fresh - ports the latest zlib version (now 1.2.8)
- Tested - result is binary equal to zlib's one
- No restrictions - MIT licence
__Benchmarks:__
```
2014-02-19 14:40:53 +00:00
node v0.10, 10mb sample:
2014-02-18 17:55:32 +00:00
2014-02-19 14:40:53 +00:00
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)
2014-02-18 17:55:32 +00:00
node v0.11, 10mb sample:
2014-02-19 14:40:53 +00:00
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)
2014-02-18 17:55:32 +00:00
```
2014-02-18 22:10:11 +00:00
__Install:__
2014-02-18 17:55:32 +00:00
2014-02-18 22:10:11 +00:00
node.js:
2014-02-18 17:55:32 +00:00
2014-02-18 22:10:11 +00:00
```
npm install pako
```
browser:
```
bower install pako
```
Example & API
-------------
2014-02-19 21:38:10 +00:00
[Full docs](http://nodeca.github.io/pako/).
2014-02-18 22:10:11 +00:00
```javascript
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;
```
2014-02-18 17:55:32 +00:00
Notes
-----
2014-02-19 21:38:10 +00:00
Pako does not contains some very specific zlib functions.
2014-02-18 17:55:32 +00:00
2014-02-19 21:38:10 +00:00
- __deflate__ - writing bustom gzip headers and methods `deflateSetDictionary`,
`deflateParams`, `deflateSetHeader`, `deflateBound`, `deflatePending`.
- __inflate__ - TBD.
2014-02-18 17:55:32 +00:00
2014-02-18 22:10:11 +00:00
2014-02-18 17:55:32 +00:00
Authors
-------
- Andrey Tupitsin [@anrd83](https://github.com/andr83)
2014-02-18 22:10:11 +00:00
- Vitaly Puzrin [@puzrin](https://github.com/puzrin)
2014-02-18 17:55:32 +00:00
2014-02-19 21:38:10 +00:00
Personal thanks to Vyacheslav Egorov ([@mraleph](https://github.com/mraleph))
for his awesome tutoruals about optimising JS code for v8,
[IRHydra](http://mrale.ph/irhydra/) tool and his advices.
2014-02-18 17:55:32 +00:00
License
-------
2014-02-19 14:40:53 +00:00
MIT