http-compress

HTTP framework independent response compression.
- properly checks the
Accept-Encoding header
- supports
gzip, deflate and identity encodings
- sets
Content-Encoding
Usage
'use strict'
const http = require('http')
const compress = require('http-compress')
const server = http.createServer((req, res) => {
compress(req, res, 'oh hey!')
})
server.listen(() => {
console.log(`http://localhost:${server.address().port}`)
})
Installation
$ npm install http-compress
API
compress(req, res, body)
Kudos
This was inspired by koajs/compress.
License
MIT