Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

raw-body

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

raw-body - npm Package Compare versions

Comparing version 0.0.3 to 0.1.0

31

index.js

@@ -1,7 +0,10 @@

module.exports = function (stream, options, callback) {
module.exports = function (stream, options, done) {
if (typeof options === 'function') {
callback = options
done = options
options = {}
}
if (!options)
options = {}
var limit = typeof options.limit === 'number'

@@ -20,6 +23,7 @@ ? options.limit

err.limit = limit
callback(err)
stream.resume() // dump stream
cleanup()
return
process.nextTick(function () {
done(err)
})
return defer
}

@@ -32,6 +36,11 @@

stream.once('end', onEnd)
stream.once('error', callback)
stream.once('error', cleanup)
stream.once('error', onEnd)
stream.once('close', cleanup)
return defer
function defer(fn) {
done = fn
}
function onData(chunk) {

@@ -46,3 +55,3 @@ buffers.push(chunk)

err.limit = limit
callback(err)
done(err)
cleanup()

@@ -58,5 +67,5 @@ }

err.expected = expected
callback(err)
done(err)
} else {
callback(null, Buffer.concat(buffers))
done(null, Buffer.concat(buffers))
}

@@ -72,3 +81,3 @@

stream.removeListener('end', onEnd)
stream.removeListener('error', callback)
stream.removeListener('error', done)
stream.removeListener('error', cleanup)

@@ -75,0 +84,0 @@ stream.removeListener('close', cleanup)

{
"name": "raw-body",
"description": "Get and validate the raw body of a readable stream.",
"version": "0.0.3",
"version": "0.1.0",
"author": {

@@ -21,7 +21,9 @@ "name": "Jonathan Ong",

"devDependencies": {
"mocha": "~1.12"
"co": "*",
"gnode": "*",
"mocha": "*"
},
"scripts": {
"test": "make test"
"test": "NODE=gnode make test"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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