Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var onEnd = function () {
this.push(null);
}.bind(this);
this.on('finish', function () {
this._firstStream.end();
});
this.once('pipe', function () {
this._lastStream.on('data', onData);
this._lastStream.on('end', onEnd);
}.bind(this));
};
WrapStreams.prototype = Object.create(Duplex.prototype);
WrapStreams.prototype.wrap = function (stream) {
if (!this._firstStream) {
this._firstStream = stream;
this._lastStream = stream;
} else {
this._lastStream = this._lastStream.pipe(stream);
}
stream.on('error', function (err) {
this.emit('error', err);
}.bind(this));
return this;
};
stream.once('end', function () {
var ix = self._streams.indexOf(stream);
if (ix >= 0 && ix === self._streams.length - 1) {
Duplex.prototype.push.call(self, null);
}
});
this._streams.push(stream);
BufferList.prototype.end = function (chunk) {
DuplexStream.prototype.end.call(this, chunk)
if (this._callback) {
this._callback(null, this.slice())
this._callback = null
}
}
BufferList.prototype.end = function (chunk) {
DuplexStream.prototype.end.call(this, chunk)
if (this._callback) {
this._callback(null, this.slice())
this._callback = null
}
}
ListStream.prototype.end = function (chunk) {
DuplexStream.prototype.end.call(this, chunk)
if (this._callback) {
this._callback(null, this._chunks)
this._callback = null
}
}
DataStream.prototype.end = function () {
Duplex.prototype.end.apply(this, arguments);
this._finished = true;
this._push();
};
BufferListStream.prototype.end = function end (chunk) {
DuplexStream.prototype.end.call(this, chunk)
if (this._callback) {
this._callback(null, this.slice())
this._callback = null
}
}
BufferList.prototype.end = function end (chunk) {
DuplexStream.prototype.end.call(this, chunk)
if (this._callback) {
this._callback(null, this.slice())
this._callback = null
}
}