-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
Closed
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9d48b5d
Add 'close' events to fs.ReadStream and fs.WriteSTream
ff217a8
Add 'close' event to stream.Writable per Issue #6484
827dfcb
Add #### prefix to Event: 'close' and backticks to 'close' similar to…
57aa9e6
Add more specifics to 'close' events for fs.ReadStream and fs.WriteSt…
439df4b
Fix/Changed 'close' event from 'fs.ReadStream' to 'fs.WriteStream'
b2a0db1
wrapped long lines at 80 chars, reworded
bcc8bd2
including the 'close' event as optional
8cdf720
add 'close' event as optional in stream.Readable
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add #### prefix to Event: 'close' and backticks to 'close' similar to…
… stream.Readable event: 'close' section
- Loading branch information
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -573,11 +573,11 @@ Examples of writable streams include: | |
| * [child process stdin][] | ||
| * [`process.stdout`][], [`process.stderr`][] | ||
|
|
||
| Event: 'close' | ||
| #### 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. | ||
| Not all streams will emit the `'close'` event. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will say this is an optional event for implementors. |
||
|
|
||
| #### Event: 'drain' | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this differs from
'end'?Should a user expect
'close'or'end'to proceed? Which one happens first?I will also move this block after
'end', meaning that'end'is the preferred way of waiting for the end of a stream.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcollina
I hesitate to move the 'Event: 'close'' block to after the 'Event: 'end'' block because these events seem to be in alphabetical order for better user experience.
The difference between 'close' and 'end' events:
fs.close()method and is optional. Not all streams emit this event.end()function on Streams.