Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function end () {
// We have to use our parent class directly because we suppress `finish`
// events fired via our own emit method.
Writable.prototype.emit.call(writeStream, 'finish')
// Delay the close to provide the same temporal separation a physical
// file operation would have– that is, the close event is emitted only
// after the async close operation completes.
setImmediate(function () {
writeStream.emit('close')
})
}
}
function end () {
// We have to use our parent class directly because we suppress `finish`
// events fired via our own emit method.
Writable.prototype.emit.call(writeStream, 'finish')
// Delay the close to provide the same temporal separation a physical
// file operation would have– that is, the close event is emitted only
// after the async close operation completes.
setImmediate(function () {
writeStream.emit('close')
})
}
}
function end () {
// We have to use our parent class directly because we suppress `finish`
// events fired via our own emit method.
Writable.prototype.emit.call(writeStream, 'finish')
// Delay the close to provide the same temporal separation a physical
// file operation would have– that is, the close event is emitted only
// after the async close operation completes.
setImmediate(function () {
writeStream.emit('close')
})
}
}
ObjectStream.prototype.write = function (chunk, encoding, cb) {
logger.debug("ObjectStream#write: Received chunk.");
var size = this._size(chunk);
// Size of currently called write value + size of all buffered calls.
this.length += size;
// Disregard original return value.
Writable.prototype.write.call(this, ...arguments);
var ret = this.length < this.__highWaterMark;
if (!ret) {
logger.debug("ObjectStream#write: Need drain.");
this._writableState.needDrain = true;
}
return ret;
};
WriteStreamAtomic.prototype.emit = function (event) {
if (event === 'finish') return this.__atomicStream.end()
return Writable.prototype.emit.apply(this, arguments)
}
WriteStreamAtomic.prototype.emit = function (event) {
if (event === 'finish') return this.__atomicStream.end()
return Writable.prototype.emit.apply(this, arguments)
}
WriteStreamAtomic.prototype.emit = function (event) {
if (event === 'finish') return this.__atomicStream.end()
return Writable.prototype.emit.apply(this, arguments)
}