Namespace Pollution Mechanism
Miss any of our Open RFC calls?Watch the recordings here! »

@rill/compress

1.0.5 • Public • Published

Rill
@rill/compress
API stability Standard NPM version Downloads Gitter Chat

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!

Install

npm i @rill/compress

DownloadsWeekly Downloads

1

Version

1.0.5

License

MIT

Last publish

Collaborators

  • avatar