Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function Writable(fn, options) {
if (!(this instanceof Writable))
return new Writable(fn, options);
PassThrough.call(this, options);
beforeFirstCall(this, '_write', function() {
var destination = fn.call(this, options);
var emit = this.emit.bind(this, 'error');
destination.on('error', emit);
this.pipe(destination);
});
this.emit('writable');
}
function Writable(fn, options) {
if (!(this instanceof Writable))
return new Writable(fn, options);
PassThrough.call(this, options);
beforeFirstCall(this, '_write', function() {
var destination = fn.call(this, options);
var emit = this.emit.bind(this, 'error');
destination.on('error', emit);
this.pipe(destination);
});
this.emit('writable');
}
function Readable(fn, options) {
if (!(this instanceof Readable))
return new Readable(fn, options);
PassThrough.call(this, options);
beforeFirstCall(this, '_read', function() {
var source = fn.call(this, options);
var emit = this.emit.bind(this, 'error');
source.on('error', emit);
source.pipe(this);
});
this.emit('readable');
}
function Readable(fn, options) {
if (!(this instanceof Readable))
return new Readable(fn, options);
PassThrough.call(this, options);
beforeFirstCall(this, '_read', function() {
var source = fn.call(this, options);
var emit = this.emit.bind(this, 'error');
source.on('error', emit);
source.pipe(this);
});
this.emit('readable');
}
function PullStream(opts) {
var self = this;
this.opts = opts || {};
PassThrough.call(this, opts);
this.once('finish', function() {
self._writesFinished = true;
if (self._flushed) {
self._finish();
}
});
this.on('readable', function() {
self._process();
});
}
inherits(PullStream, PassThrough);
function Entry () {
PassThrough.call(this);
this.props = {};
}