Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

pako

> 编程语言
Open source

high speed zlib port to javascript, works in browser & node.js

6.1K stars0 likes6 views
WebsiteGitHub

About

high speed zlib port to javascript, works in browser & node.js

pako

Very fast zlib-compatible compression for JavaScript.

Why pako is cool

  • Binary-equivalent output. Pako can produce the same deflate/gzip bytes as original zlib (1.3.2) and Node.js' patched zlib.
  • Tiny browser bundles. Full minified bundle is under 15K gzipped. Deflate-only and inflate-only builds are smaller.
  • Very fast. Performance is comparable with native zlib in modern JavaScript engines (see benchmarks).

Benchmarks

node v24, 1 MB input sample:

deflate-pako x 14.27 ops/sec ±3.41% (37 runs sampled)
deflate-pako-zlib-hash x 10.60 ops/sec ±0.50% (29 runs sampled)
deflate-zlib x 30.30 ops/sec ±0.61% (51 runs sampled)
gzip-pako x 13.48 ops/sec ±0.50% (36 runs sampled)
inflate-pako x 138 ops/sec ±1.26% (75 runs sampled)
inflate-zlib x 397 ops/sec ±1.37% (81 runs sampled)
ungzip-pako x 125 ops/sec ±1.46% (73 runs sampled)

Install

bash
npm install pako

[!NOTE] For a quick look at dist/ folder contents, see https://unpkg.com/pako@latest/.

Examples / API

Full docs - http://nodeca.github.io/pako/

…

For CommonJS:

javascript
const { deflate, inflate } = require('pako');

If you need the whole API as an object, use namespace import:

javascript
import * as pako from 'pako';

Sometimes you may wish to work with strings — for example, to send stringified objects to a server. Pako's deflate detects the input data type and automatically recodes strings to utf-8 prior to compression. High-level inflate helpers can decode utf-8 output back to JavaScript strings with toText: true.

javascript
import { deflate, inflate } from 'pako';

const test = { my: 'super', puper: [456, 567], awesome: 'pako' };

const compressed = deflate(JSON.stringify(test));

const restored = JSON.parse(inflate(compressed, { toText: true }));

Notes

Pako does not contain some specific zlib functions:

  • deflate - methods deflateCopy, deflateBound, deflateParams, deflatePending, deflatePrime, deflateTune.
  • inflate - methods inflateCopy, inflateMark, inflatePrime, inflateGetDictionary, inflateSync, inflateSyncPoint, inflateUndermine.
  • High level inflate/deflate wrappers (classes) may not support some flush modes.

Authors

  • Andrey Tupitsin @anrd83
  • Vitaly Puzrin @puzrin

Personal thanks to:

  • Vyacheslav Egorov (@mraleph) for his awesome tutorials about optimising JS code for v8, IRHydra tool and his advices.
  • David Duponchel (@dduponchel) for help with testing.

Original implementation (in C):

  • zlib by Jean-loup Gailly and Mark Adler.

License

  • MIT - all files, except /src/zlib folder
  • ZLIB - /src/zlib content

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScriptzlibzlib-port

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言