Package Exports
- koa-spdy-push
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (koa-spdy-push) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Koa SPDY Push
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 lowestbody- a body of the stream, either aString,Buffer, orStream.Readablefilename- 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-encodingcontent-length