Skip to content
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

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

Closed
wants to merge 8 commits into from
Closed

Conversation

jennabelle
Copy link
Contributor

Checklist
  • [ x ] documentation is changed or added
  • [ x ] the commit message follows commit guidelines
Affected core subsystem(s)
Description of change

Per Issue #6484

  1. Add 'close' event to doc/api/fs.md --> fs.ReadStream
  2. Add 'close' event to doc/api/fs.md --> fs.WriteStream
  3. Add 'close event to doc/api/stream.md --> stream.Writable

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label May 1, 2016
@mscdex mscdex added fs Issues and PRs related to the fs subsystem / file system. stream Issues and PRs related to the stream subsystem. labels May 1, 2016
@@ -572,6 +572,12 @@ Examples of writable streams include:
* [TCP sockets][]
* [child process stdin][]
* [`process.stdout`][], [`process.stderr`][]

Event: 'close'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be prefixed with ####.

@jennabelle
Copy link
Contributor Author

@mscdex made those changes you requested let me know if anything further is needed

@@ -151,6 +151,10 @@ 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. Comes from fs.close() method.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a "the" in front of fs.close(). Also, please put fs.close() in backticks.

Copy link
Member

@jasnell jasnell May 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested rewording (note also the addition of the backticks )

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

(same below for WriteStream also)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the note about fs.close() really that helpful/useful? Maybe we could just drop that part entirely?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with it either way

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I ask is because either way we're wording it makes it kind of sound like the end user is expected to call fs.close()/stream.close() to see this event.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think 'close' is emitted only with fs.close(), or am I wrong?

@cjihrig
Copy link
Contributor

cjihrig commented May 1, 2016

Can you wrap long lines at 80 characters.

@jasnell
Copy link
Member

jasnell commented May 1, 2016

LGTM with nits addressed

@jasnell
Copy link
Member

jasnell commented May 1, 2016

@nodejs/documentation @nodejs/streams


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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will say this is an optional event for implementors.

@mcollina
Copy link
Member

mcollina commented May 2, 2016

Good work @jennabelle! We need more of these, keep them coming. All the streams API needs a lot of help anyway, and we need to tackle the "big" challenge of documenting the whole state machine. If you like, join us in our monthly meeting: nodejs/readable-stream#196.

@jennabelle
Copy link
Contributor Author

@mcollina Thank you! I am a new contributor so any tips and feedback are welcome. Looking forward to collaborating more!

@mscdex
Copy link
Contributor

mscdex commented May 2, 2016

LGTM

@jasnell
Copy link
Member

jasnell commented May 3, 2016

Is this ready to land?

@eljefedelrodeodeljefe
Copy link
Contributor

Sorry to be so nitty but the last line is 81 chars. Otherwise LGTM.

@eljefedelrodeodeljefe
Copy link
Contributor

Thanks for the effort @jennabelle

@addaleax
Copy link
Member

addaleax commented May 3, 2016

LGTM with wrapped lines, too. Thanks!

@addaleax
Copy link
Member

addaleax commented May 3, 2016

Btw, the .close() method itself is currently undocumented, but I guess that doesn’t have to happen here. And ping @Trott because he talked about that in irc.

@jasnell
Copy link
Member

jasnell commented May 3, 2016

@eljefedelrodeodeljefe @addaleax ... that can be fixed quickly by whomever lands the PR :-)

@eljefedelrodeodeljefe
Copy link
Contributor

Didn't know that we are allowed and ecouraged to edit contents except commit messages while landing. Good to know. Then let's do it.

@addaleax
Copy link
Member

addaleax commented May 3, 2016

@eljefedelrodeodeljefe Care to do the honours? 😉

@jasnell
Copy link
Member

jasnell commented May 3, 2016

It's generally preferable to have the author of the PR edit the nits overall but for extremely minor stuff fixing on landing is fine, especially when they're just linting or linewrap issues. Just make sure you squash the additional commit and maintain the original author.

eljefedelrodeodeljefe pushed a commit that referenced this pull request May 3, 2016
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>
@mcollina
Copy link
Member

mcollina commented May 3, 2016

Can we get a couple more LGTMs from @nodejs/streams?

@mafintosh can you have a look?

@eljefedelrodeodeljefe
Copy link
Contributor

Thanks. Landed in 2aa3769.

@mcollina
Copy link
Member

mcollina commented May 3, 2016

@mafintosh can you have a look anyway? :)

@eljefedelrodeodeljefe
Copy link
Contributor

Yeh, sorry :) Give me a ping if somethings wrong @mafintosh

@addaleax
Copy link
Member

addaleax commented May 3, 2016

@eljefedelrodeodeljefe Btw, I think the Fixes: field should contain the full issue URL, too. :)

Fishrock123 pushed a commit that referenced this pull request May 4, 2016
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>
joelostrowski pushed a commit to joelostrowski/node that referenced this pull request May 4, 2016
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 nodejs#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 nodejs#6484
including the 'close' event as optional
add 'close' event as optional in stream.Readable
per issue nodejs#6484
doc: Add 'close' events to fs.ReadStream, 80char nit

Fixes: nodejs#6484
PR-URL: nodejs#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>
addaleax pushed a commit to addaleax/node that referenced this pull request Jul 12, 2016
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 nodejs#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 nodejs#6484
including the 'close' event as optional
add 'close' event as optional in stream.Readable
per issue nodejs#6484
doc: Add 'close' events to fs.ReadStream, 80char nit

Fixes: nodejs#6484
PR-URL: nodejs#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>
MylesBorins pushed a commit that referenced this pull request Jul 12, 2016
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>
MylesBorins pushed a commit that referenced this pull request Jul 12, 2016
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>
@MylesBorins MylesBorins mentioned this pull request Jul 12, 2016
MylesBorins pushed a commit that referenced this pull request Jul 14, 2016
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>
MylesBorins pushed a commit that referenced this pull request Jul 14, 2016
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system. stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants