Skip to content

Documentation/Add 'close' events to fs.ReadStream, fs.WriteStream, etc per Issue #6484 #6499

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ Stop watching for changes on the given `fs.FSWatcher`.

Emitted when the ReadStream's file is opened.

### Event: 'close'

Emitted when the `ReadStream`'s underlying file descriptor has been closed
using the `fs.close()` method.

### readStream.path

The path to the file the stream is reading from as specified in the first
Expand Down Expand Up @@ -238,6 +243,11 @@ on Unix systems, it never was.

Emitted when the WriteStream's file is opened.

### Event: 'close'

Emitted when the `WriteStream`'s underlying file descriptor has been closed
using the `fs.close()` method.

### writeStream.bytesWritten

The number of bytes written so far. Does not include data that is still queued
Expand Down
10 changes: 9 additions & 1 deletion doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Emitted when the stream and any of its underlying resources (a file
descriptor, for example) have been closed. The event indicates that
no more events will be emitted, and no further computation will occur.

Not all streams will emit the `'close'` event.
Not all streams will emit the `'close'` event as the `'close'` event is optional.

#### Event: 'data'

Expand Down Expand Up @@ -572,6 +572,14 @@ Examples of writable streams include:
* [TCP sockets][]
* [child process stdin][]
* [`process.stdout`][], [`process.stderr`][]

#### Event: 'close'

Emitted when the stream and any of its underlying resources (a file descriptor,
for example) have been closed. The event indicates that no more events will be
emitted, and no further computation will occur.

Not all streams will emit the `'close'` event as the `'close'` event is optional.

#### Event: 'drain'

Expand Down