GeezerVison is showing github.com — doc: adds 'close' events to fs.ReadStream and fs.WriteStream · nodejs/node@33f24c8
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: doc/api/fs.md +10Lines changed: 10 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -151,6 +151,11 @@ Stop watching for changes on the given `fs.FSWatcher`. |
151 | 151 |
|
152 | 152 | Emitted when the ReadStream's file is opened. |
153 | 153 |
|
| 154 | +### Event: 'close' |
| 155 | + |
| 156 | +Emitted when the `ReadStream`'s underlying file descriptor has been closed |
| 157 | +using the `fs.close()` method. |
| 158 | + |
154 | 159 | ### readStream.path |
155 | 160 |
|
156 | 161 | The path to the file the stream is reading from as specified in the first |
@@ -238,6 +243,11 @@ on Unix systems, it never was. |
238 | 243 |
|
239 | 244 | Emitted when the WriteStream's file is opened. |
240 | 245 |
|
| 246 | +### Event: 'close' |
| 247 | + |
| 248 | +Emitted when the `WriteStream`'s underlying file descriptor has been closed |
| 249 | +using the `fs.close()` method. |
| 250 | + |
241 | 251 | ### writeStream.bytesWritten |
242 | 252 |
|
243 | 253 | The number of bytes written so far. Does not include data that is still queued |
|
Collapse file
Copy file name to clipboardExpand all lines: doc/api/stream.md +11-1Lines changed: 11 additions & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -160,7 +160,8 @@ Emitted when the stream and any of its underlying resources (a file |
160 | 160 | descriptor, for example) have been closed. The event indicates that |
161 | 161 | no more events will be emitted, and no further computation will occur. |
162 | 162 |
|
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. |
164 | 165 |
|
165 | 166 | #### Event: 'data' |
166 | 167 |
|
@@ -573,6 +574,15 @@ Examples of writable streams include: |
573 | 574 | * [child process stdin][] |
574 | 575 | * [`process.stdout`][], [`process.stderr`][] |
575 | 576 |
|
| 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 | + |
576 | 586 | #### Event: 'drain' |
577 | 587 |
|
578 | 588 | If a [`stream.write(chunk)`][stream-write] call returns `false`, then the |
|