Socket
Socket
Sign inDemoInstall

koa-spdy-push

Package Overview
Dependencies
8
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    koa-spdy-push

SPDY Push helper for Koa


Version published
Weekly downloads
2
increased by100%
Maintainers
3
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 11 Sep 2014

Did you know?

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc