Skip to content

Commit 2244a3c

Browse files
Jenna VuongMyles Borins
Jenna Vuong
authored and
Myles Borins
committed
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 <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Robert Jefe Lindstaedt <[email protected]>
1 parent 88f46b8 commit 2244a3c

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

doc/api/fs.md

+10
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ Stop watching for changes on the given `fs.FSWatcher`.
126126

127127
Emitted when the ReadStream's file is opened.
128128

129+
### Event: 'close'
130+
131+
Emitted when the `ReadStream`'s underlying file descriptor has been closed
132+
using the `fs.close()` method.
133+
129134
### readStream.path
130135

131136
The path to the file the stream is reading from.
@@ -210,6 +215,11 @@ on Unix systems, it never was.
210215

211216
Emitted when the WriteStream's file is opened.
212217

218+
### Event: 'close'
219+
220+
Emitted when the `WriteStream`'s underlying file descriptor has been closed
221+
using the `fs.close()` method.
222+
213223
### writeStream.bytesWritten
214224

215225
The number of bytes written so far. Does not include data that is still queued

doc/api/stream.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ Emitted when the stream and any of its underlying resources (a file
160160
descriptor, for example) have been closed. The event indicates that
161161
no more events will be emitted, and no further computation will occur.
162162

163-
Not all streams will emit the `'close'` event.
163+
Not all streams will emit the `'close'` event as the `'close'` event is
164+
optional.
164165

165166
#### Event: 'data'
166167

@@ -573,6 +574,15 @@ Examples of writable streams include:
573574
* [child process stdin][]
574575
* [`process.stdout`][], [`process.stderr`][]
575576

577+
#### Event: 'close'
578+
579+
Emitted when the stream and any of its underlying resources (a file descriptor,
580+
for example) have been closed. The event indicates that no more events will be
581+
emitted, and no further computation will occur.
582+
583+
Not all streams will emit the `'close'` event as the `'close'` event is
584+
optional.
585+
576586
#### Event: 'drain'
577587

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

0 commit comments

Comments
 (0)