http-compress
v1.0.1
Published
HTTP framework independent response compression
Downloads
2
Readme
http-compress
HTTP framework independent response compression.
- properly checks the
Accept-Encoding
header - supports
gzip
,deflate
andidentity
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