@rill/compress
v1.0.5
Published
Response compression middleware for Rill.
Downloads
92
Maintainers
Readme
Isomorphic response body compression middleware for Rill using gzip or deflate if available.
Installation
npm install @rill/compress
Example
const app = require('rill')()
const compress = require('@rill/compress')
app.use(compress())
app.use(({ req, res }, next)=> {
// Send this file.
// Supported encodings: gzip, deflate and identity.
res.body = fs.createReadStream(__filename)
})
API Options / Defaults.
{
// The minimum response size to compress.
threshold: "1kb",
// Optional function to filter compressed responses by content-type.
filter: function (contentType) { ... }
}
Contributions
- Use gulp to run tests.
Please feel free to create a PR!