0.3.2 • Published 10 years ago

koa-spdy-push v0.3.2

Weekly downloads
27
License
MIT
Repository
github
Last release
10 years ago

Koa SPDY Push

NPM version Build status Test coverage Dependency Status License Downloads Gittip

SPDY Push helper for Koa. Automatically handles close events and errors to avoid leaks.

API

push(this, options)

var push = require('koa-spdy-push')({
  threshold: 1kb
})

app.use(function* () {
  if (!this.res.isSpdy) return

  push(this, {
    path: '/image.png',
    filename: 'image.png',
    headers: {
      'content-type': 'image/png'
    }
  })
})

Pushes a file in a separate coroutine. Options:

  • path - The url of the stream
  • headers - Headers of the stream
  • priority: 7 - SPDY Push stream priority, defaults to lowest
  • body - a body of the stream, either a String, Buffer, or Stream.Readable
  • filename - a filename of a body. Use this to push bodies without creating a stream first (otherwise you'll create file descriptor leaks)

Either body or filename is required.

Don't set the following headers. These headers will be automatically set:

  • content-encoding
  • content-length
0.3.2

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.10

10 years ago

0.1.9

10 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.0

10 years ago