Comparing version 1.1.6 to 1.1.7
25
index.js
@@ -1,4 +0,6 @@ | ||
var StringDecoder = require('string_decoder').StringDecoder | ||
var bytes = require('bytes') | ||
// NOTE: the trailing slash is not a typo | ||
var StringDecoder = require('string_decoder/').StringDecoder | ||
module.exports = function (stream, options, done) { | ||
@@ -118,3 +120,3 @@ if (typeof options === 'function') { | ||
done(null, decoder | ||
? buffer + endStringDecoder(decoder) | ||
? buffer + decoder.end() | ||
: Buffer.concat(buffer) | ||
@@ -151,20 +153,1 @@ ) | ||
} | ||
// https://github.com/Raynos/body/blob/2512ced39e31776e5a2f7492b907330badac3a40/index.js#L72 | ||
// bug fix for missing `StringDecoder.end` in v0.8.x | ||
function endStringDecoder(decoder) { | ||
if (decoder.end) { | ||
return decoder.end() | ||
} | ||
var res = "" | ||
if (decoder.charReceived) { | ||
var cr = decoder.charReceived | ||
var buf = decoder.charBuffer | ||
var enc = decoder.encoding | ||
res += buf.slice(0, cr).toString(enc) | ||
} | ||
return res | ||
} |
{ | ||
"name": "raw-body", | ||
"description": "Get and validate the raw body of a readable stream.", | ||
"version": "1.1.6", | ||
"author": { | ||
"name": "Jonathan Ong", | ||
"email": "me@jongleberry.com", | ||
"url": "http://jongleberry.com", | ||
"twitter": "https://twitter.com/jongleberry" | ||
}, | ||
"version": "1.1.7", | ||
"author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/stream-utils/raw-body.git" | ||
}, | ||
"bugs": { | ||
"mail": "me@jongleberry.com", | ||
"url": "https://github.com/stream-utils/raw-body/issues" | ||
}, | ||
"repository": "stream-utils/raw-body", | ||
"dependencies": { | ||
"bytes": "1" | ||
"bytes": "1", | ||
"string_decoder": "0.10" | ||
}, | ||
"devDependencies": { | ||
"istanbul": "0.2.10", | ||
"mocha": "~1.20.1", | ||
"readable-stream": "~1.0.17", | ||
"co": "3", | ||
"gnode": "~0.0.4", | ||
"mocha": "^1.14.0", | ||
"through2": "~0.4.1", | ||
"request": "^2.27.0", | ||
"assert-tap": "~0.1.4" | ||
"request": ">= 2.36.0 < 3", | ||
"through2": "~0.4.1" | ||
}, | ||
"scripts": { | ||
"test": "NODE=gnode make test && node ./test/acceptance.js" | ||
}, | ||
"engines": { | ||
"node": ">= 0.8.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha --reporter spec --bail test/", | ||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/", | ||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec test/" | ||
} | ||
} |
@@ -1,3 +0,7 @@ | ||
# Raw Body [![Build Status](https://travis-ci.org/stream-utils/raw-body.svg?branch=master)](https://travis-ci.org/stream-utils/raw-body) | ||
# raw-body | ||
[![NPM version](https://badge.fury.io/js/method-override.svg)](http://badge.fury.io/js/raw-body) | ||
[![Build Status](https://travis-ci.org/stream-utils/raw-body.svg?branch=master)](https://travis-ci.org/stream-utils/raw-body) | ||
[![Coverage Status](https://img.shields.io/coveralls/stream-utils/raw-body.svg?branch=master)](https://coveralls.io/r/stream-utils/raw-body) | ||
Gets the entire buffer of a stream either as a `Buffer` or a string. | ||
@@ -4,0 +8,0 @@ Validates the stream's length against an expected length and maximum limit. |
Sorry, the diff of this file is not supported yet
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
9749
5
101
0
2
132
1
1
+ Addedstring_decoder@0.10
+ Addedstring_decoder@0.10.31(transitive)