mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Attach event listener to clone only for Stream #995
This commit is contained in:
14
lib/input.js
14
lib/input.js
@@ -155,12 +155,14 @@ function clone () {
|
||||
const clone = this.constructor.call();
|
||||
clone.options = Object.assign({}, this.options);
|
||||
// Pass 'finish' event to clone for Stream-based input
|
||||
this.on('finish', function () {
|
||||
// Clone inherits input data
|
||||
that._flattenBufferIn();
|
||||
clone.options.bufferIn = that.options.bufferIn;
|
||||
clone.emit('finish');
|
||||
});
|
||||
if (this._isStreamInput()) {
|
||||
this.on('finish', function () {
|
||||
// Clone inherits input data
|
||||
that._flattenBufferIn();
|
||||
clone.options.bufferIn = that.options.bufferIn;
|
||||
clone.emit('finish');
|
||||
});
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user