Isomorphic response body compression middleware for Rill using gzip or deflate if available.
npm install @rill/compress
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)
})
{
// The minimum response size to compress.
threshold: "1kb",
// Optional function to filter compressed responses by content-type.
filter: function (contentType) { ... }
}
- Use gulp to run tests.
Please feel free to create a PR!