Skip to content
streaming http compression response negotiator
Branch: master
Clone or download
substack Merge pull request #2 from searls/patch-1
Removed obsolete note.
Latest commit acac1c6 Jan 9, 2014
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example fs.createReadStream() example Aug 28, 2012
test oh right the test data too Aug 28, 2012
.travis.yml using travis Aug 28, 2012
LICENSE package.json etc Aug 28, 2012
index.js using response-stream for the http server response method passing Aug 29, 2012
package.json 0.0.1 Aug 29, 2012
readme.markdown Removed obsolete note. Jan 8, 2014

readme.markdown

oppressor

streaming http compression response negotiator

build status

example

You can use plain old streams:

var oppressor = require('oppressor');
var fs = require('fs');
var http = require('http');

var server = http.createServer(function (req, res) {
    fs.createReadStream(__dirname + '/data.txt')
        .pipe(oppressor(req))
        .pipe(res)
    ;
});
server.listen(8000);

or you can use fancy streaming static file server modules like filed that set handy things like etag, last-modified, and content-type headers for you:

var oppressor = require('oppressor');
var filed = require('filed');
var http = require('http');

var server = http.createServer(function (req, res) {
     filed(__dirname + '/data.txt')
        .pipe(oppressor(req))
        .pipe(res)
    ;
});
server.listen(8000);

methods

var oppressor = require('oppressor')

var stream = oppressor(req)

Return a duplex stream that will be compressed with gzip, deflate, or no compression depending on the accept-encoding headers sent.

oppressor will emulate calls to http.ServerResponse methods like writeHead() so that modules like filed that expect to be piped directly to the response object will work.

install

With npm do:

npm install oppressor

license

MIT

You can’t perform that action at this time.