Socket
Socket
Sign inDemoInstall

koa-spdy-push

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-spdy-push

SPDY Push helper for Koa


Version published
Weekly downloads
4
decreased by-81.82%
Maintainers
2
Weekly downloads
 
Created
Source

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* () {
  is (!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

FAQs

Package last updated on 13 Jun 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc