diff --git a/lib/internal/fs/streams.js b/lib/internal/fs/streams.js index 87d58a8be55f80..d51fbb1b580113 100644 --- a/lib/internal/fs/streams.js +++ b/lib/internal/fs/streams.js @@ -61,7 +61,9 @@ function ReadStream(path, options) { options.highWaterMark = 64 * 1024; // For backwards compat do not emit close on destroy. - options.emitClose = false; + if (options.emitClose === undefined) { + options.emitClose = false; + } Readable.call(this, options); @@ -237,7 +239,9 @@ function WriteStream(path, options) { options = copyObject(getOptions(options, {})); // For backwards compat do not emit close on destroy. - options.emitClose = false; + if (options.emitClose === undefined) { + options.emitClose = false; + } Writable.call(this, options);