1.0.1 • Published 7 years ago

http-compress v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

http-compress

Development sponsored by voltra.co

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

1.0.1

7 years ago

1.0.0

7 years ago