Skip to content

Event 'close' emits twice (fs.createWriteStream) #31366

@ledeneveugene

Description

@ledeneveugene

if i set (emitClose: false) then on version 12.14.1 event emits once.
Documentation: By default, the stream will not emit a 'close' event after it has been destroyed. This is the opposite of the default for other Writable streams. Set the emitClose option to true to change this behavior.

const fileWriteStream = fs.createWriteStream(saveTo, {emitClose: true});
file.pipe(fileWriteStream);
fileWriteStream.on('close', function () {
console.log('fileWriteStream.on(close')
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions