@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!

Package Sidebar

Install

npm i @rill/compress

Weekly Downloads

32

Version

1.0.5

License

MIT

Last publish

Collaborators

  • dylanpiercey