Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
doc: adds 'close' events to fs.ReadStream and fs.WriteStream
Add 'close' event to doc/api/fs.md --> fs.ReadStream
Add 'close' event to doc/api/fs.md --> fs.WriteStream
Add 'close event to doc/api/stream.md --> stream.Writable

From squashed history:
Add 'close' event to stream.Writable per Issue #6484
Add #### prefix to Event: 'close' and backticks to 'close'
similar to stream.Readable event: 'close' section
Add more specifics to 'close' events for fs.ReadStream
and fs.WriteStream
Fix/Changed 'close' event from 'fs.ReadStream' to 'fs.WriteStream'
wrapped long lines at 80 chars, reworded
per Issue #6484
including the 'close' event as optional
add 'close' event as optional in stream.Readable
per issue #6484
doc: Add 'close' events to fs.ReadStream, 80char nit

Fixes: #6484
PR-URL: #6499
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
  • Loading branch information
Jenna Vuong authored and addaleax committed Jul 12, 2016
commit 1aa955a3b5e0f1dce5c5a7f99a2a3c7f3bcdc9b5
10 changes: 10 additions & 0 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,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.
Expand Down Expand Up @@ -210,6 +215,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
12 changes: 11 additions & 1 deletion doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ 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 @@ -573,6 +574,15 @@ Examples of writable streams include:
* [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'

If a [`stream.write(chunk)`][stream-write] call returns `false`, then the
Expand Down