koa-spdy-push
Advanced tools
Comparing version 0.1.5 to 0.1.6
25
index.js
@@ -7,3 +7,2 @@ | ||
var fs = require('fs') | ||
var co = require('co') | ||
@@ -17,9 +16,3 @@ module.exports = function (compressOptions) { | ||
var _push = co(push) | ||
return function (context, options) { | ||
_push(context, options, context.onerror) | ||
} | ||
function* push(context, options) { | ||
return function push(context, options) { | ||
// koa properties | ||
@@ -42,3 +35,3 @@ var res = context.res | ||
// check whether to compress the stream | ||
var length = yield* contentLength() | ||
var length = contentLength() | ||
var compress = (body || filename) | ||
@@ -99,9 +92,7 @@ && (typeof length !== 'number' || length > threshold) | ||
function* contentLength() { | ||
function contentLength() { | ||
if (filename) { | ||
// already set | ||
if (headers['content-length']) return parseInt(headers['content-length'], 0) | ||
// causing spdy issues because it occurs on next tick | ||
// return (yield stat(filename)).size | ||
return false | ||
if (!headers['content-length']) return false | ||
return parseInt(headers['content-length'], 10) | ||
} | ||
@@ -124,8 +115,2 @@ | ||
// function stat(filename) { | ||
// return function (done) { | ||
// fs.stat(filename, done) | ||
// } | ||
// } | ||
function filterError(err) { | ||
@@ -132,0 +117,0 @@ if (err == null) return |
{ | ||
"name": "koa-spdy-push", | ||
"description": "SPDY Push helper for Koa", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"author": { | ||
@@ -16,4 +16,3 @@ "name": "Jonathan Ong", | ||
"dethroy": "1", | ||
"bytes": "0", | ||
"co": "3" | ||
"bytes": "1" | ||
}, | ||
@@ -20,0 +19,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
11857
287
+ Addedbytes@1.0.0(transitive)
- Removedco@3
- Removedbytes@0.3.0(transitive)
- Removedco@3.1.0(transitive)
Updatedbytes@1