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

read-all-stream

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-all-stream - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

43

index.js

@@ -40,27 +40,34 @@ 'use strict';

var promise = new Promise(function (resolve, reject) {
var sink = new BufferStream();
var promise;
sink.on('finish', function () {
var data = Buffer.concat(this.buffer, this.length);
if (!cb) {
var resolve, reject;
promise = new Promise(function(_res, _rej) {
resolve = _res;
reject = _rej;
});
if (options.encoding) {
data = data.toString(options.encoding);
}
cb = function (err, data) {
if (err) { return reject(err); }
resolve(data);
});
};
}
stream.once('error', reject);
var sink = new BufferStream();
stream.pipe(sink);
sink.on('finish', function () {
var data = Buffer.concat(this.buffer, this.length);
if (options.encoding) {
data = data.toString(options.encoding);
}
cb(null, data);
});
if (!cb) {
return promise;
}
stream.once('error', cb);
promise.then(function (data) {
cb(null, data);
}, cb);
};
stream.pipe(sink);
return promise;
}
{
"name": "read-all-stream",
"version": "3.0.0",
"version": "3.0.1",
"description": "Read all stream content and pass it to callback",

@@ -5,0 +5,0 @@ "license": "MIT",

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