Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A streaming compression for node.js
tag: v0.0.3

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
LICENSE
README
bzfiletest.js
bzip.cc
bztest.js
compress.cc
filetest.js
gzip.cc
test.js
utils.h
wscript

README

node-compress
=============

A streaming compression module for node.js.

Supports gzip and bzip2 compression/decompression.

To install, ensure that you have libz and libbz2 installed, and run:

node-waf configure 
node-waf build

This will put the compress.node binary module in build/default. 


Quick example
-------------

var compress=require("./compress");
var sys=require("sys");
var posix=require("posix");

// Create gzip stream
var gzip=new compress.Gzip;
gzip.init();

// Pump data to be compressed
var gzdata1 = gzip.deflate("My data that needs ", "binary"); 
sys.puts("Compressed size : "+gzdata1.length);

var gzdata2 = gzip.deflate("to be compressed. 01234567890.", "binary"); 
sys.puts("Compressed size : "+gzdata2.length);

var gzdata3 = gzip.end();
sys.puts("Last bit : "+gzdata3.length);

// Normally stream this out as its generated, but just print here
var gzdata = gzdata1+gzdata2+gzdata3;
sys.puts("Total compressed size : "+gzdata.length);
Something went wrong with that request. Please try again.