Socket
Socket
Sign inDemoInstall

spdy-push

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spdy-push - npm Package Compare versions

Comparing version 0.0.0 to 1.0.0

lib/index.js

20

package.json
{
"name": "spdy-push",
"description": "",
"version": "0.0.0",
"description": "SPDY Push helper",
"version": "1.0.0",
"author": {

@@ -14,6 +14,8 @@ "name": "Jonathan Ong",

"dependencies": {
"bluebird": "^2.3.2",
"bytes": "^1.0.0",
"compressible": "^1.1.1",
"compressible": "2",
"debug": "*",
"destroy": "^1.0.3",
"mime-types": "^1.0.2",
"mime-types": "2",
"mz": "^1.0.1",

@@ -23,10 +25,7 @@ "native-or-bluebird": "^1.1.0"

"devDependencies": {
"co": "3",
"raw-body": "1",
"mocha": "1",
"supertest": "0",
"spdy": "1",
"spdy-keys": "0",
"istanbul": "0",
"mocha": "1"
"istanbul": "0"
},

@@ -45,4 +44,5 @@ "scripts": {

"files": [
"index.js"
]
"lib"
],
"main": "lib"
}

@@ -5,3 +5,2 @@

[![NPM version][npm-image]][npm-url]
[![Latest tag][github-tag]][github-url]
[![Build status][travis-image]][travis-url]

@@ -14,2 +13,50 @@ [![Test coverage][coveralls-image]][coveralls-url]

A SPDY Push helper to be used with [spdy](https://github.com/indutny/node-spdy).
- Handles `close` events and file descriptor leaks
- Automatically gzips
- Automatically sets the `content-length` and `content-type` headers if it can
- Supports pushing strings, buffers, streams, and files
## Example
```js
var spdy = require('spdy-push');
require('spdy').createServer(require('spdy-keys'), function (req, res) {
if (res.isSpdy) {
spdy(res).push('/script.js', {
filename: 'public/script.js', // resolves against CWD
}).catch(function (err) {
console.error(err.stack); // log any critical errors
})
}
res.statusCode = 204;
res.end();
})
```
## API
### spdy(res).push([path], [options], [priority])
- `path` is the path of the object being pushed.
Can also be set as `options.path`.
- `priority` is the priority between `0-7` of the push stream
with `7`, the default, being the lowest priority.
Can also be set as `options.priority`.
- `options` are:
- `headers`
- `body` - a `String`, `Buffer`, or `Stream.Readable` body
- `filename` - a path to a file. Resolves against CWD.
Either `options.body` or `options.filename` must be set.
You do not need to set the following headers:
- `content-encoding`
- `content-length`
- `content-type`
[npm-image]: https://img.shields.io/npm/v/spdy-push.svg?style=flat-square

@@ -16,0 +63,0 @@ [npm-url]: https://npmjs.org/package/spdy-push

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