Fork me on GitHub

Tom Gallacher

GZIPPO - Source Code

gzippo, pronounced g-zippo and created by Tom Gallacher is a gzip NodeJS middleware for Connect / Express using node-compress for much better performace than any other connect gzip or express gzip middleware.

The reason behind the performace increase is, unlike the deprecated connect gzip implemention and modules based onthis (such as connect-gzip), gzippo does not use child_process.exec to spawn a process, instead using native C++ code. gzippo can be found in the node package manager npm.

Sites gzippo is current used on (that I know about) (this site =])

If you are using gzippo let me know or create a pull request and I will link you here =]


$ npm install gzippo


Static Gzip

In your express/connect server setup, use as follows:

var gzippo = require('gzippo');
//Replace the default connect or express static provider with gzippo's
//app.use(express.static(__dirname + '/public'));
app.use(gzippo.staticGzip(__dirname + '/public'));


contentTypeMatch - A regular expression tested against the Content-Type header to determine whether the response should be gzipped or not. The default value is /text|javascript|json/.

maxAge - cache-control max-age directive, defaulting to 1 day

clientMaxAge - browser cache-control max-age directive, defaulting to 1 week

prefix - A url prefix. If you want all your static content in a root path such as /resource/. Any url paths not matching will be ignored

Streaming Gzip

Starting in Connect 2.X Expressjs has the ability to use a streaming gzip module provided natively by connect. This will gzip streaming responses including JSON and html responses. As this 2.X branch is not currently stable I have back ported the compress.js component into gzippo.

app.use(gzippo.staticGzip(__dirname + '/public'));

This has no caching and is currently unsupported as it will be included in a future connect 1.X release, up until then compress.js will be included in gzippo.