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

readable-stream

Package Overview
Dependencies
Maintainers
6
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

readable-stream - npm Package Compare versions

Comparing version 2.3.3 to 2.3.4

2

lib/_stream_duplex.js

@@ -31,3 +31,3 @@ // Copyright Joyent, Inc. and other Node contributors.

var processNextTick = require('process-nextick-args');
var processNextTick = require('process-nextick-args').nextTick;
/*</replacement>*/

@@ -34,0 +34,0 @@

@@ -26,3 +26,3 @@ // Copyright Joyent, Inc. and other Node contributors.

var processNextTick = require('process-nextick-args');
var processNextTick = require('process-nextick-args').nextTick;
/*</replacement>*/

@@ -54,5 +54,4 @@

// TODO(bmeurer): Change this back to const once hole checks are
// properly optimized away early in Ignition+TurboFan.
/*<replacement>*/
var Buffer = require('safe-buffer').Buffer;

@@ -66,2 +65,3 @@ var OurUint8Array = global.Uint8Array || function () {};

}
/*</replacement>*/

@@ -95,11 +95,9 @@

// event emitter implementation with them.
if (typeof emitter.prependListener === 'function') {
return emitter.prependListener(event, fn);
} else {
// This is a hack to make sure that our error handler is attached before any
// userland ones. NEVER DO THIS. This is here only because this code needs
// to continue to work with older versions of Node.js that do not include
// the prependListener() method. The goal is to eventually remove this hack.
if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
}
if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
// This is a hack to make sure that our error handler is attached before any
// userland ones. NEVER DO THIS. This is here only because this code needs
// to continue to work with older versions of Node.js that do not include
// the prependListener() method. The goal is to eventually remove this hack.
if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
}

@@ -112,2 +110,9 @@

// Duplex streams are both readable and writable, but share
// the same options object.
// However, some cases require setting options to different
// values for the readable and the writable sides of the duplex stream.
// These options can be provided separately as readableXXX and writableXXX.
var isDuplex = stream instanceof Duplex;
// object stream flag. Used to make read(n) ignore n and to

@@ -117,3 +122,3 @@ // make all the buffer merging and length checks go away

if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;

@@ -123,5 +128,7 @@ // the point at which it stops calling _read() to fill the buffer

var hwm = options.highWaterMark;
var readableHwm = options.readableHighWaterMark;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
// cast to ints.

@@ -820,6 +827,7 @@ this.highWaterMark = Math.floor(this.highWaterMark);

Readable.prototype.wrap = function (stream) {
var _this = this;
var state = this._readableState;
var paused = false;
var self = this;
stream.on('end', function () {

@@ -829,6 +837,6 @@ debug('wrapped end');

var chunk = state.decoder.end();
if (chunk && chunk.length) self.push(chunk);
if (chunk && chunk.length) _this.push(chunk);
}
self.push(null);
_this.push(null);
});

@@ -843,3 +851,3 @@

var ret = self.push(chunk);
var ret = _this.push(chunk);
if (!ret) {

@@ -865,3 +873,3 @@ paused = true;

for (var n = 0; n < kProxyEvents.length; n++) {
stream.on(kProxyEvents[n], self.emit.bind(self, kProxyEvents[n]));
stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
}

@@ -871,3 +879,3 @@

// underlying stream.
self._read = function (n) {
this._read = function (n) {
debug('wrapped _read', n);

@@ -880,3 +888,3 @@ if (paused) {

return self;
return this;
};

@@ -883,0 +891,0 @@

@@ -77,16 +77,4 @@ // Copyright Joyent, Inc. and other Node contributors.

function TransformState(stream) {
this.afterTransform = function (er, data) {
return afterTransform(stream, er, data);
};
this.needTransform = false;
this.transforming = false;
this.writecb = null;
this.writechunk = null;
this.writeencoding = null;
}
function afterTransform(stream, er, data) {
var ts = stream._transformState;
function afterTransform(er, data) {
var ts = this._transformState;
ts.transforming = false;

@@ -97,3 +85,3 @@

if (!cb) {
return stream.emit('error', new Error('write callback called multiple times'));
return this.emit('error', new Error('write callback called multiple times'));
}

@@ -104,10 +92,11 @@

if (data !== null && data !== undefined) stream.push(data);
if (data != null) // single equals check for both `null` and `undefined`
this.push(data);
cb(er);
var rs = stream._readableState;
var rs = this._readableState;
rs.reading = false;
if (rs.needReadable || rs.length < rs.highWaterMark) {
stream._read(rs.highWaterMark);
this._read(rs.highWaterMark);
}

@@ -121,6 +110,11 @@ }

this._transformState = new TransformState(this);
this._transformState = {
afterTransform: afterTransform.bind(this),
needTransform: false,
transforming: false,
writecb: null,
writechunk: null,
writeencoding: null
};
var stream = this;
// start out asking for a readable event once data is transformed.

@@ -141,9 +135,17 @@ this._readableState.needReadable = true;

// When the writable side finishes, then flush out anything remaining.
this.once('prefinish', function () {
if (typeof this._flush === 'function') this._flush(function (er, data) {
done(stream, er, data);
});else done(stream);
});
this.on('prefinish', prefinish);
}
function prefinish() {
var _this = this;
if (typeof this._flush === 'function') {
this._flush(function (er, data) {
done(_this, er, data);
});
} else {
done(this, null, null);
}
}
Transform.prototype.push = function (chunk, encoding) {

@@ -196,7 +198,7 @@ this._transformState.needTransform = false;

Transform.prototype._destroy = function (err, cb) {
var _this = this;
var _this2 = this;
Duplex.prototype._destroy.call(this, err, function (err2) {
cb(err2);
_this.emit('close');
_this2.emit('close');
});

@@ -208,14 +210,12 @@ };

if (data !== null && data !== undefined) stream.push(data);
if (data != null) // single equals check for both `null` and `undefined`
stream.push(data);
// if there's nothing in the write buffer, then that means
// that nothing more will ever be provided
var ws = stream._writableState;
var ts = stream._transformState;
if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
if (ws.length) throw new Error('Calling transform done when ws.length != 0');
if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
if (ts.transforming) throw new Error('Calling transform done when still transforming');
return stream.push(null);
}

@@ -30,3 +30,3 @@ // Copyright Joyent, Inc. and other Node contributors.

var processNextTick = require('process-nextick-args');
var processNextTick = require('process-nextick-args').nextTick;
/*</replacement>*/

@@ -83,2 +83,3 @@

/*<replacement>*/
var Buffer = require('safe-buffer').Buffer;

@@ -92,2 +93,3 @@ var OurUint8Array = global.Uint8Array || function () {};

}
/*</replacement>*/

@@ -106,2 +108,9 @@

// Duplex streams are both readable and writable, but share
// the same options object.
// However, some cases require setting options to different
// values for the readable and the writable sides of the duplex stream.
// These options can be provided separately as readableXXX and writableXXX.
var isDuplex = stream instanceof Duplex;
// object stream flag to indicate whether or not this stream

@@ -111,3 +120,3 @@ // contains buffers or objects.

if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;

@@ -118,5 +127,7 @@ // the point at which write() starts returning false

var hwm = options.highWaterMark;
var writableHwm = options.writableHighWaterMark;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
// cast to ints.

@@ -234,2 +245,3 @@ this.highWaterMark = Math.floor(this.highWaterMark);

if (realHasInstance.call(this, object)) return true;
if (this !== Writable) return false;

@@ -312,3 +324,3 @@ return object && object._writableState instanceof WritableState;

var ret = false;
var isBuf = _isUint8Array(chunk) && !state.objectMode;
var isBuf = !state.objectMode && _isUint8Array(chunk);

@@ -525,2 +537,3 @@ if (isBuf && !Buffer.isBuffer(chunk)) {

}
state.bufferedRequestCount = 0;
} else {

@@ -536,2 +549,3 @@ // Slow case, write chunks one-by-one

entry = entry.next;
state.bufferedRequestCount--;
// if we didn't call the onwrite immediately, then

@@ -549,3 +563,2 @@ // it means that we need to wait until it does.

state.bufferedRequestCount = 0;
state.bufferedRequest = entry;

@@ -552,0 +565,0 @@ state.bufferProcessing = false;

'use strict';
/*<replacement>*/
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Buffer = require('safe-buffer').Buffer;
/*</replacement>*/
var util = require('util');

@@ -74,2 +72,9 @@ function copyBuffer(src, target, offset) {

return BufferList;
}();
}();
if (util && util.inspect && util.inspect.custom) {
module.exports.prototype[util.inspect.custom] = function () {
var obj = util.inspect({ length: this.length });
return this.constructor.name + ' ' + obj;
};
}

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

var processNextTick = require('process-nextick-args');
var processNextTick = require('process-nextick-args').nextTick;
/*</replacement>*/

@@ -22,3 +22,3 @@

}
return;
return this;
}

@@ -48,2 +48,4 @@

});
return this;
}

@@ -50,0 +52,0 @@

{
"name": "readable-stream",
"version": "2.3.3",
"version": "2.3.4",
"description": "Streams3, a user-land copy of the stream library from Node.js",

@@ -10,3 +10,3 @@ "main": "readable.js",

"isarray": "~1.0.0",
"process-nextick-args": "~1.0.6",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",

@@ -17,9 +17,9 @@ "string_decoder": "~1.0.3",

"devDependencies": {
"assert": "~1.4.0",
"assert": "^1.4.0",
"babel-polyfill": "^6.9.1",
"buffer": "^4.9.0",
"nyc": "^6.4.0",
"tap": "~0.7.1",
"tape": "~4.5.1",
"zuul": "~3.10.0"
"tap": "^0.7.0",
"tape": "^4.8.0",
"zuul": "^3.11.1"
},

@@ -26,0 +26,0 @@ "scripts": {

# readable-stream
***Node-core v8.1.3 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream)
***Node-core v8.9.4 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream)

@@ -21,3 +21,3 @@

Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.1.3/docs/api/stream.html).
Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.9.4/docs/api/stream.html).

@@ -59,1 +59,2 @@ If you want to guarantee a stable streams base, regardless of what version of

- Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E
* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) &lt;shestak.irina@gmail.com&gt;

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