node-compress

by waveto

waveto /node-compress

A streaming compression / gzip library for node.js

127 Stars 50 Forks Last release: Not found Other 4 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

node-compress

A streaming compression / gzip module for node.js

To install, ensure that you have libz 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);

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.