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

Cherrypick v0.12 doc updates #2302

Closed
wants to merge 17 commits into from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Aug 4, 2015

Cherrypicked commits from nodejs/node-v0.x-archive#25635

These include a handful of doc and comment fixes that landed in v0.12. Some of the commits had to be updated slightly to land.

jasnell and others added 16 commits August 4, 2015 14:13
Per nodejs#4409, the documentation on http.abort is a bit lacking.
This provides a slight improvement.

Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs/node-v0.x-archive#25591
Per: nodejs/node-v0.x-archive@b7229de

The documentation for createWriteStream() references an
'encoding' property that has a default value of null. However,
this property is never referenced by createWriteStream() or
WritableState(). Instead a 'defaultEncoding' property is
referenced in WritableState() with a default of 'utf8' if no value
is supplied.

This fix updates the documentation to rename the 'encoding'
property to 'defaultEncoding' and indicate its default value of
'utf8'.

Originally Contributed By: @chrisneave

(The original patch did not apply clean)
per: nodejs/node-v0.x-archive@53b6a61

fixes nodejs/node-v0.x-archive#7230

Original commit patch did not apply cleanly

Originally contributed by @sarathms
Original: nodejs/node-v0.x-archive#8682

Slightly modified version of the original PR (nodejs#8682) to add
appropriate line wrapping and fix a couple of grammar nits.

Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs/node-v0.x-archive#25591
Per: nodejs/node-v0.x-archive@16f5476

Originally contributed by: @scop

Original commit patch did not apply cleanly
Per: nodejs/node-v0.x-archive@5ccb429

Originally contributed by @scop

Original commit patch did not apply cleanly
per: nodejs/node-v0.x-archive@59c67fe

Originally contributed by @skypjack

Original commit patch did not land cleanly
'the' to 'then'

Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs/node-v0.x-archive#25591
Made explicitely clear that when size bytes are not available,
it will return null, unless we've ended, in which case the data
remaining in the buffer will be returned.

Fixes nodejs#7273

Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs/node-v0.x-archive#25591
Clarifies that emitter.listener() returns a copy, not a reference
Resolves issue nodejs#9022

Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs/node-v0.x-archive#25591
per: nodejs/node-v0.x-archive#14596

1. document that a runtime error will occur if you attempt
   to unshift after the end event
2. document that calling read after the end event will return
   null and will not trigger a runtime error

Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs/node-v0.x-archive#25591
Minor clarifications around Readable._read and Readable.push
to make their implementation/usage easier to understand.

nodejs/node-v0.x-archive#14124 (comment)

Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs/node-v0.x-archive#25591
Per nodejs/node-v0.x-archive#14604,

Document that performing an `unshift` during a read
can have unexpected results. Following the `unshift`
with a `push('')` resets the reading state appropriately.
Also indicate that doing an `unshift` during a read
is not optimal and should be avoided.

Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs/node-v0.x-archive#25591
per nodejs/node-v0.x-archive#14597

Indicate that `'readable'` indicates only that data can
be read from the stream, not that there is actually data
to be consumed. `readable.read([size])` can still return
null. Includes an example that illustrates the point.

Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs/node-v0.x-archive#25591
Per nodejs/node-v0.x-archive#25635 (comment)

Additional refinement to the clarification on the `readable` event

Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs/node-v0.x-archive#25591
@jasnell jasnell self-assigned this Aug 4, 2015
@@ -801,6 +801,10 @@ on Unix systems, it never was.

Returns a new ReadStream object (See `Readable Stream`).

Be aware that, unlike the default value set for `highWaterMark` on a
readable stream(16kb), the stream returned by this method has a
Copy link
Member

Choose a reason for hiding this comment

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

Space before paren? Also, isn't it more common (and correct) to write it as 16 kB?

@mscdex mscdex added the doc Issues and PRs related to the documentations. label Aug 4, 2015
@bnoordhuis
Copy link
Member

I don't really care for the typo fixes in comments but whatever. LGTM sans the two things I pointed out.

Additional edits based on Ben's feedback
@bnoordhuis
Copy link
Member

LGTM

@jasnell
Copy link
Member Author

jasnell commented Aug 4, 2015

Just as a clarification, would you prefer that I land this as separate commits or squash them down and list each of the originals in the commit message?

jasnell added a commit that referenced this pull request Aug 5, 2015
 * doc: improve http.abort description
 * doc: mention that mode is ignored if file exists
 * docs: Fix default options for fs.createWriteStream()
 * Documentation update about Buffer initialization
 * doc: add a note about readable in flowing mode
 * doc: Document http.request protocol option
 * doc, comments: Grammar and spelling fixes
 * updated documentation for fs.createReadStream
 * Update child_process.markdown, spelling
 * doc: Clarified read method with specified size argument.
 * docs:events clarify emitter.listener() behavior
 * doc: two minor stream doc improvements
 * doc: clarify Readable._read and Readable.push
 * doc: stream.unshift does not reset reading state
 * doc: readable event clarification
 * doc: additional refinement to readable event

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noorduis <ben@strongloop.com>
PR-URL: #2302
@jasnell
Copy link
Member Author

jasnell commented Aug 5, 2015

Landed in 936c9ff

@jasnell jasnell closed this Aug 5, 2015
@rvagg
Copy link
Member

rvagg commented Aug 5, 2015

applied the new land-on-v3.x tag, don't need to actually land it right now but I'd love us to get into this habit early

@jasnell
Copy link
Member Author

jasnell commented Aug 5, 2015

+1. It would be trivial to cherry pick 936c9ff onto v3.x but agreed, this one is a low priority.

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants