Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including jszlib with all npm packages installed. Try it out:

var jszlib = require("jszlib")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

jszlib v0.0.1

deflate implemented in pure js.

Build Status


This provides an all js version of deflate. The goal is to provide a similar api to node's built in zlib. This provides a sync deflate that node native does not. Contributions welcome!


var jszlib = require('jszlib'),
watcher = jszlib.deflate('aaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbb',function(error,buffer){


npm install jszlib

argument structure

jszlib.deflate(buffer, [options], callback)

jszlib.deflateSync(buffer, [options]);

  • buffer

    • this can be a String or node Buffer object.
  • options.

    • right now no options need to be passed in from the outside.
  • callback

    • for non sync the buffer is passed as the data argument to the callback.



most of the code is by imaya who wrote a cool js png encoder. Thanks!! I ported this to node requires and updated the interface to be more nodey.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free