2.0.1 • Published 8 years ago

toa-compress v2.0.1

Weekly downloads
47
License
-
Repository
github
Last release
8 years ago

toa-compress

compress responses middleware for toa.

NPM version Build Status Downloads

toa

Demo

const Toa = require('toa')
const compress = require('../')

const app = new Toa()
app.use(compress())
app.use(function () {
  this.body = require('../package.json')
})

app.listen(3000)

compress stream:

const fs = require('fs')
const path = require('path')
const Toa = require('toa')
const compress = require('../')

const app = new Toa()
app.use(compress())
app.use(function () {
  this.body = fs.createReadStream(path.resolve(__dirname, '../package.json'))
  this.type = 'json'
})

app.listen(3000)

Installation

npm install toa-compress

API

const compress = require('toa-compress')

app.use(compress(options))

  • options.threshold: Number, Default 1024, the threshold length that should compress.
app.use(compress({threshold: 1024}))

Licences

(The MIT License)

2.0.1

8 years ago

2.0.0

9 years ago

1.2.4

9 years ago

1.2.3

9 years ago

1.2.2

9 years ago

1.2.1

9 years ago

1.2.0

10 years ago

1.1.2

10 years ago

1.1.1

11 years ago

1.1.0

11 years ago

1.0.0

11 years ago