Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 71 lines (46 sloc) 3.149 kB
a06eef1 @tomgco Github name change to tomgco from tomgallacher
tomgco authored
1 # gzippo [![Build Status](https://secure.travis-ci.org/tomgco/gzippo.png?branch=master)](https://secure.travis-ci.org/tomgco/gzippo)
4258093 @tomgco Adding bitcoin donation
tomgco authored
2
dc3c8e4 @tomgco Updating docs
tomgco authored
3 gzippo pronounced `g-zippo` is a gzip middleware for Connect / expressjs using node-compress for better performace, in node 0.6 and up will be using the new zlib api.
4258093 @tomgco Adding bitcoin donation
tomgco authored
4
17ca150 @tomgco Updating README.md
tomgco authored
5 gzippo currently only supports only gzipping static content files however a release is in progress to introduce streaming support.
4258093 @tomgco Adding bitcoin donation
tomgco authored
6
a09b696 @tomgco Adding notice
tomgco authored
7 ## Notice
8
a6bc8d6 @tomgco Fixing #30 in README
tomgco authored
9 Please note that gzippo@0.0.X branch will only be tested for nodejs 0.4, where as gzippo@0.1.X will work for node 0.6
a09b696 @tomgco Adding notice
tomgco authored
10
4258093 @tomgco Adding bitcoin donation
tomgco authored
11 ## Installation
53ae9f0 @serby Adding static path prefix
serby authored
12
4258093 @tomgco Adding bitcoin donation
tomgco authored
13 $ npm install gzippo
14
15 ### Usage
6c938e2 @tomgco Updating readme
tomgco authored
16 #### Static Gzip
4258093 @tomgco Adding bitcoin donation
tomgco authored
17
18 In your express/connect server setup, use as follows:
53ae9f0 @serby Adding static path prefix
serby authored
19
4258093 @tomgco Adding bitcoin donation
tomgco authored
20 var gzippo = require('gzippo');
53ae9f0 @serby Adding static path prefix
serby authored
21
4258093 @tomgco Adding bitcoin donation
tomgco authored
22 //Replace the static provider with gzippo's
23 //app.use(express.static(__dirname + '/public'));
24 app.use(gzippo.staticGzip(__dirname + '/public'));
25
26 Options:
27
c50384c @jhuckabee Fix matchType references with contentTypeMatch
jhuckabee authored
28 - `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/`.
4258093 @tomgco Adding bitcoin donation
tomgco authored
29 - `maxAge` - cache-control max-age directive, defaulting to 1 day
d370626 @tomgco Adding client max age directives
tomgco authored
30 - `clientMaxAge` - browser cache-control max-age directive, defaulting to 1 week
53ae9f0 @serby Adding static path prefix
serby authored
31 - `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
4258093 @tomgco Adding bitcoin donation
tomgco authored
32
33 Currently the gzipped version is created and stored in memory. This is not final and was done to get a working version
6c938e2 @tomgco Updating readme
tomgco authored
34 up and about.
17ca150 @tomgco Updating README.md
tomgco authored
35
e861c5f @tomgco Updating readme
tomgco authored
36 Gzippo now uses the native Zlib support found in node >= 0.6
37
6c938e2 @tomgco Updating readme
tomgco authored
38 #### Streaming Gzip
39
40 Starting in Connect 2.X Expressjs has the ability to use a streaming gzip module provided natively by connect. As this 2.X branch is not currently stable I have back ported the compress.js component into gzippo.
41
42 app.use(gzippo.staticGzip(__dirname + '/public'));
43 app.use(gzippo.compress());
44
45 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.
46
4258093 @tomgco Adding bitcoin donation
tomgco authored
47 ## License
48
49 (The MIT License)
50
f7718f0 @tomgco Updating Website
tomgco authored
51 Copyright (c) 2011 Tom Gallacher &lt;<http://www.tomg.co>&gt;
4258093 @tomgco Adding bitcoin donation
tomgco authored
52
53 Permission is hereby granted, free of charge, to any person obtaining
54 a copy of this software and associated documentation files (the
55 'Software'), to deal in the Software without restriction, including
56 without limitation the rights to use, copy, modify, merge, publish,
57 distribute, sublicense, and/or sell copies of the Software, and to
58 permit persons to whom the Software is furnished to do so, subject to
59 the following conditions:
60
61 The above copyright notice and this permission notice shall be
62 included in all copies or substantial portions of the Software.
63
64 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
65 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
66 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
67 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
68 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
69 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
c50384c @jhuckabee Fix matchType references with contentTypeMatch
jhuckabee authored
70 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.