Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 38 lines (25 sloc) 0.911 kB
9fcd743 @waveto first commit
authored
1 node-compress
2 =============
3
4 A streaming compression / gzip module for node.js
5
6 To install, ensure that you have openssl installed, and run:
7
8 node-waf configure
9 node-waf build
10
11 This will put the compress.node binary module in build/default.
12
13
14 Quick example
15 -------------
16
17 var compress=require("./compress");
18 var sys=require("sys");
19 var posix=require("posix");
20
21 // Create gzip stream
22 var gzip=new compress.Gzip;
23 gzip.init();
24
25 // Pump data to be compressed
26 var gzdata1 = gzip.deflate("My data that needs ", "binary");
27 sys.puts("Compressed size : "+gzdata1.length);
28
29 var gzdata2 = gzip.deflate("to be compressed. 01234567890.", "binary");
30 sys.puts("Compressed size : "+gzdata2.length);
31
32 var gzdata3 = gzip.end();
33 sys.puts("Last bit : "+gzdata3.length);
34
35 // Normally stream this out as its generated, but just print here
36 var gzdata = gzdata1+gzdata2+gzdata3;
37 sys.puts("Total compressed size : "+gzdata.length);
Something went wrong with that request. Please try again.