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 2.2.0 to 3.0.0

31

index.js

@@ -5,2 +5,3 @@ 'use strict';

var inherits = require('util').inherits;
var Promise = require('pinkie-promise');

@@ -40,21 +41,27 @@ function BufferStream() {

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

@@ -30,4 +30,5 @@ "license": "MIT",

"dependencies": {
"pinkie-promise": "^1.0.0",
"readable-stream": "^2.0.0"
}
}

@@ -17,2 +17,6 @@ # read-all-stream [![Build Status][travis-image]][travis-url]

read(stream).then(function (data) {
console.log(data.length);
});
read(stream, 'utf8', function (err, data) {

@@ -27,4 +31,6 @@ console.log(data.length);

#### read(stream, [options], callback)
#### read(stream, [options], [callback])
If callback is omitted, Promise will be returned.
##### stream

@@ -53,2 +59,4 @@

Will be called after stream is read.
###### err

@@ -55,0 +63,0 @@

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