JavaScript port of ZLib DEFLATE for the browser


zpipe is not a pipe.

The famous pipe. How people reproached me for it! And yet, could you stuff my pipe? No, it's just a representation, is it not? So if I had written on my picture "This is a pipe," I'd have been lying!

z'pipe exposes an interface to the DEFLATE algorithm of the ZLib compression library, it has been cross-compiled to JavaScript with Emscripten.

  • Help users suffering from poor upload bandwidth
  • Currently no compression API exposed in browsers

Regular <script> include ...

<script type="text/javascript" src="zpipe.min.js"></script>
    var deflated = zpipe.deflate("the balloon");
    var inflated = zpipe.inflate(deflated); // "the balloon"

With require() ...

var zpipe = require("zpipe");
var deflated = zpipe.deflate("the balloon");
var inflated = zpipe.inflate(deflated); // "the balloon" 

Install the package with npm.

$ npm install zpipe

Alternatively just add it to your Ender packages.

$ ender add zpipe

Ok 201 KB for zpipe.min.js is big, however it comes in at 57.6 KB gzipped. This is acceptable.

Test against node zlib:

$ make test # Run the tests

Run the test in the browser by pointing your browser to test/test.html.

z'pipe operates on octet strings only, UTF-16 characters will have their high byte masked.

  • Support stream compression through workers
  • Benchmarks