0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

107 Commits

Author SHA1 Message Date
Jackson Tian
d2b93e55cc lib: reduce usage of self = this
Remove unnecessary `self = this`.

PR-URL: https://github.com/nodejs/node/pull/5231
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-21 15:48:51 -07:00
Kevin Locke
b801e39266 doc: clarify when writable.write callback is called
The current documentation for writable.write only specifies that the
callback is called "once the data has been fully handled".  It is
ambiguous whether this means "successfully handled" and, if so,
whether the callback is called if the data can not be successfully
handled (i.e. an error occurs).

The ambiguity is not only in the documentation.  The stream class
implementations differ on this point.  stream.Writable invokes the
callback with any errors that occur during parameter checking or
during calls to _write.  However, not all classes return all errors
to _write. zlib.Zlib does pass argument and state errors to the
_write (_transform) callback, but does not pass data errors.
http.OutgoingMessage passes argument type errors and some other types
of errors, but not all.

This inconsistency is behind issue #1746 and, I suspect, other issues
in client code which passes a callback to write.

This commit takes no position on whether the callback error behavior
should changed, but simply attempts to document the current behavior
in a way that is open to changes so that users are not caught by
surprise.

PR-URL: https://github.com/nodejs/node/pull/4810
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremy Whitlock <jwhitlock@apache.org>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2016-03-14 19:46:49 +02:00
Anton Andesen
8d8fef09ee doc: add note for binary safe string reading
`readable.setEncoding(null)` - may be the most preferable way to proxy
a binary data without any encoding/decoding overhead

PR-URL: https://github.com/nodejs/node/pull/5155
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-02-29 11:08:45 +01:00
Claudio Rodriguez
47e926a8d6 doc: fix type references for link gen, link css
Fixes several type references in the docs so that the
doc html gen tool that parses them can put the correct
links in.

Changes css styling for the generated type links.

PR-URL: https://github.com/nodejs/node/pull/4741
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Chris Dickinson <chris@neversaw.us>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-02-09 13:12:21 +01:00
Alexander Makarenko
b0b4aeb640 doc: multiple improvements in Stream docs
Add missing links, remove duplicate ones, fix constants and functions styling.
Minor lexical corrections.

PR-URL: https://github.com/nodejs/node/pull/5009
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-02-02 09:53:37 -08:00
piepmatz
d74eb5fe01 doc: fix anchor links from stream to http and events
PR-URL: https://github.com/nodejs/node/pull/5007
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-02-02 09:01:23 -08:00
Benjamin Gruenbaum
334a7e3614 doc: replace function expressions with arrows
This commit replaces multiple usages of `function(){}` with ES2015
arrow functions in places it was forgotten earlier. The goal is to
make the docs more consistent since other functions were already
replaced with ES2015 arrows.

In addition, it fixes invalid syntax in modules.markdown to valid
syntax as well as remove `var self = this` pattern usages in the code
where they are now possible to avoid through arrow functions.

PR-URL: https://github.com/nodejs/node/pull/4832
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-27 23:00:20 +01:00
Robert Jefe Lindstaedt
17d5a3ab99 doc: proper markdown escaping -> \_\_, \*, \_
PR-URL: https://github.com/nodejs/node/pull/4805
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2016-01-22 21:32:50 -08:00
Robert Jefe Lindstaedt
e436272897 doc: fenced all code blocks, typo fixes
This changes the code blocks from 4-space indentation to ``` fences for
better syntax highlighting and future linting support. Minor On-the-fly
changes for typos and highlight breaking markdown have been made.

JSON-Style objects have been changed so their closing bracket is
on the same line as the opening one.

Known issues:
* Not every JSON / object notation has been improved. Should
  make another run for this.
* Some example functions break hightlighting due to various
  combinations of brackets. However changing them means leaving
  the code style.

Fixes: https://github.com/nodejs/node/issues/4726
PR-URL: https://github.com/nodejs/node/pull/4733
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-21 20:55:09 +01:00
cjihrig
eee9dc7e9d Revert "stream: add bytesRead property for readable"
This reverts commit bfb2cd0bfd.

The bytesRead property, as implemented, tracks characters
instead of bytes when using an identity encoding.

Refs: https://github.com/nodejs/node/pull/4372
PR-URL: https://github.com/nodejs/node/pull/4746
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-18 13:13:04 -05:00
Jackson Tian
bfb2cd0bfd stream: add bytesRead property for readable
Add a bytesRead property for readable is
useful in some use cases.

When user want know how many bytes read of
readable, need to caculate it in userland.
If encoding is specificed, get the value is
very slowly.

PR-URL: https://github.com/nodejs/node/pull/4372
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-14 17:34:29 -08:00
Vitor Cortez
3470574cb6 doc: clarify explanation of first stream section
The last sentence of the explanation for the first stream section
seemed a bit confusing. I tried to change the sentence to clarify it.

Additionally, the sections were turned into a numbered list to be more
clear about which section is being described, and improve readability.

PR-URL: https://github.com/nodejs/node/pull/4234
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-14 17:03:19 -08:00
zoubin
eeb6fdcd0f doc: add docs for more stream options
PR-URL: https://github.com/nodejs/node/pull/4639
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chris Dickinson <chris@neversaw.us>
2016-01-12 12:49:42 -08:00
Richard Sun
a2e77cedef doc: remove "above" and "below" references
The docs were recently refactored, and some "above" and "below"
references were no longer accurate. This commit removes many
such references, and replaces others with links.

PR-URL: https://github.com/nodejs/node/pull/4499
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-11 13:06:00 -05:00
Richard Sun
5194a1e3ce doc: fix numbering in stream.markdown
PR-URL: https://github.com/nodejs/node/pull/4538
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-01-05 10:24:15 -05:00
iamchenxin
1de6e4f9ab doc: add anchors for _transform _flush _writev in stream.markdown
PR-URL: https://github.com/nodejs/node/pull/4448
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-12-30 11:49:47 -08:00
James M Snell
9b21119e17 doc: fix, modernize examples in docs
* Use single quotes consistently
* Modernize examples to use template strings and arrow funcs
* Fix a few typos
* Example edits for consistency

PR-URL: https://github.com/nodejs/node/pull/4282
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-12-17 08:07:29 -08:00
jpersson
14b3aab7d2 doc: add links and backticks around names
* add backticks around names
* add single quotes around event names
* add parenthesis after function names
* add internal links between different sections
* add external links to MDN for some JavaScript references
* sort the link definitions alphabetically

PR-URL: https://github.com/nodejs/node/pull/4054
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-12-03 13:39:09 -08:00
Bryan English
cd1123a0fb doc: consistent reference-style links
Moved all the URLs in API docs to the bottom of the files as
reference-style links.

PR-URL: https://github.com/nodejs/node/pull/3845
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-11-16 07:36:59 -08:00
Tom Gallacher
4270e7f0f7 doc: Updated streams simplified constructor API
The examples for implementing the simplified constructor API
was missing some details on its correct usages.

PR-URL: https://github.com/nodejs/node/pull/3602
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chris Dickinson <chris@neversaw.us>
2015-11-13 13:27:11 -08:00
Tristian Flanagan
4efa7deeb2 doc: sort stream alphabetically
Reorders, with no contextual changes, the stream documentation
alphabetically.

PR-URL: https://github.com/nodejs/node/pull/3662
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-11-12 17:41:06 -08:00
Jeremiah Senkpiel
892bf65d9a doc: fix two doc errors in stream and process
`process.stdout` always blocks as of
20176a9841

`WritableState.buffer` is `getBuffer()` as of
91586661c9

PR-URL: https://github.com/nodejs/node/pull/2549
Reviewed-By: Alexis Campailla <orangemocha@nodejs.org>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2015-09-14 09:39:59 -04:00
James M Snell
09768e306c doc: minor additional corrections and improvements
Per feedback from @thefourtheye: (a) improve word on the
description of the `close` event in stream.markdown and
(b) remove `[module section]: modules.html` from
globals.markdown

Reviewed By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/2378
2015-08-25 18:52:52 -07:00
James M Snell
db4cb338be doc: clarification on the 'close' event
per: https://github.com/joyent/node/pull/8209

originally submitted by @jeromew

Reviewed By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/2378
2015-08-25 18:51:53 -07:00
James M Snell
5299a743d5 doc: improve working in stream.markdown
per: https://github.com/joyent/node/pull/8430

originally submitted by @mscdex

Reviewed By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/2378
2015-08-25 18:51:47 -07:00
cjihrig
a69ab27ab4 node: rename from io.js to node
This commit replaces instances of io.js with Node.js, based on the
recent convergence. There are some remaining instances of io.js,
related to build and the installer.

Fixes: https://github.com/nodejs/node/issues/2361
PR-URL: https://github.com/nodejs/node/pull/2367
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
2015-08-23 17:59:43 -04:00
James M Snell
936c9ffb0f doc: multiple documentation updates cherry picked from v0.12
* 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: https://github.com/nodejs/io.js/pull/2302
2015-08-05 08:44:55 -07:00
Ivan Yan
c370bd3aea doc: make the abbreviation 1MM clear
Refs: https://github.com/nodejs/io.js/pull/2050
PR-URL: https://github.com/nodejs/io.js/pull/2053
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2015-06-25 11:42:09 -04:00
Alex Yursha
3ad6ea7c38 doc: remove redundant parameter in end listener.
PR-URL: https://github.com/iojs/io.js/pull/1387
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-04-11 06:53:41 +02:00
Chris Dickinson
cf0306cd71 doc: update stability index
This simplifies the stability index to 4 levels:

0 - deprecated
1 - experimental / feature-flagged
2 - stable
3 - locked

Domains has been downgraded to deprecated, assert has been
downgraded to stable. Timers and Module remain locked. All
other APIs are now stable.

PR-URL: https://github.com/iojs/io.js/pull/943
Fixes: https://github.com/iojs/io.js/issues/930
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Vladimir Kurchatkin <vladimir.kurchatkin@gmail.com>
2015-02-27 14:23:01 -08:00
René Kooi
3ab9b92e90 doc: fix stream _writev header size
PR-URL: https://github.com/iojs/io.js/pull/916
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-02-21 21:36:44 +01:00
Ben Noordhuis
789bbb91d3 doc: update node.js references in api docs
Fixes: https://github.com/iojs/io.js/issues/740
PR-URL: https://github.com/iojs/io.js/pull/750
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-02-07 17:07:15 -05:00
Sam Newman
50daee7243 stream: simpler stream constructon
Adds simplified constructor pattern, allowing users
to provide "read", "write", "transform", "flush", and
"writev" functions as stream options in lieu of subclassing.

Semver: minor
PR-URL: https://github.com/iojs/io.js/pull/697
Fixes: https://github.com/iojs/readable-stream/issues/102
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2015-02-04 20:19:39 -08:00
Johnny Ray Austin
84b05d48d9 doc: update writable streams default encoding
Setting the default encoding for a writable stream does
not return a boolean (true if successful or false if not)
as the docs indicate. Instead, if the operation is successful
nothing is returned and the method throws an error when
something goes wrong.

This stems from a contribution that was tweaked but the
docs were never updated accordingly.

PR-URL: https://github.com/iojs/io.js/pull/502
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-01-27 16:28:13 +11:00
ttrfwork
18552677d7 doc: fix minor grammar mistake in streams docs
PR-URL: https://github.com/iojs/io.js/pull/606
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-01-27 16:25:21 +11:00
Vladimir Guguiev
68a2d8f048 docs: improve Writable/Transform stream docs
Slightly fix and supplement the documentation for Writable#write and
Transform#transform methods. Make it more consistent. Mention passing
'buffer' as an encoding param in case chunk is a Buffer.

PR: https://github.com/iojs/io.js/pull/142
Reviewed-by: Bert Belder <bertbelder@gmail.com>
Reviewed-by: Rod Vagg <rod@vagg.org>
2015-01-12 23:59:31 +01:00
Calvin Metcalf
90f07a7b3e doc: document _transform callback takes 2 args
Expands the paragraph in the transform stream
implementation docs about the callback that is passed
to the _transform method to include details about how
two arguments may be passed, error and data.  A code
example is also included.

Reviewed-by: Fedor Indutny <fedor@indutny.com>

Cherry-picked-from: c8e0bdd7cf
2015-01-10 22:15:46 +01:00
Alejandro Oviedo
524882faca doc: change write() after end() streams example
Currently there's an example using http.ServerResponse stream, which
has a known bug and will not throw an error while writing after end().
Changed to a writable stream from fs which behaves as expected.

Fixes https://github.com/joyent/node/issues/8814.

PR-URL: https://github.com/iojs/io.js/pull/155
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Brendan Ashworth <squirrelslikeacorns@gmail.com>
2014-12-14 20:06:46 +01:00
Steve Mao
6e4bd494a5 doc: add missing semicolons
PR-URL: https://github.com/joyent/node/pull/8498
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-10-07 23:30:42 -07:00
Johnny Ray
f04f3a0d01 streams: set default encoding for writable streams
Add API Writable#setDefaultEncoding().

PR-URL: https://github.com/joyent/node/pull/8483
Fixes: https://github.com/joyent/node/issues/7159
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-10-07 17:04:10 -07:00
Trevor Norris
f2a78de6ec doc: fix optional parameter parsing
The parameter parser specifically looked for the old bracket syntax.
This generated a lot of warnings when building the docs. Those warnings
have been fixed by changing the parsing logic.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-09-29 16:32:34 -07:00
Trevor Norris
51b6b6844e doc: fix brackets for optional parameters
Documentation incorrectly used bracket notation for optional parameters.
This caused inconsistencies in usage because of examples like the
following:

    fs.write(fd, data[, position[, encoding]], callback)

This simply fixes all uses of bracket notation in documentation.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
2014-09-25 11:26:15 -07:00
Chris Dickinson
4ef2a5a672 net,stream: add isPaused, don't read() when paused
net Sockets were calling read(0) to start reading, without
checking to see if they were paused first. This would result
in paused Socket objects keeping the event loop alive.

Fixes #8200

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-08-20 13:58:12 -07:00
Kyle Robinson Young
00004160a1 doc: typo fixes on stream, tls and http
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-08-12 21:04:41 -07:00
Timothy J Fontaine
a5778cdf01 Merge remote-tracking branch 'upstream/v0.10' into v0.12
Conflicts:
	ChangeLog
	Makefile
	deps/uv/ChangeLog
	deps/uv/build.mk
	deps/uv/src/unix/darwin.c
	deps/uv/src/unix/getaddrinfo.c
	deps/uv/src/version.c
	deps/v8/src/checks.h
	deps/v8/src/isolate.h
	lib/cluster.js
	lib/module.js
	lib/timers.js
	lib/tls.js
	src/node_version.h
2014-08-07 16:33:35 -07:00
Maciej Małecki
d6b4766a78 doc: document arguments for 'error' event on a stream
Fixes #6361.
2014-08-07 12:19:33 -07:00
Fedor Indutny
9920ae67b5 Merge branch 'v0.10'
Conflicts:
	ChangeLog
	lib/events.js
	lib/tls.js
	src/node_constants.cc
	src/node_crypto.cc
	src/node_crypto.h
	src/node_version.h
2014-06-05 07:28:39 -07:00
Calvin Metcalf
31150df92a doc: clarify end vs finish in streams
Adds a section to the transform stream docs to clarify the
difference between the `end` event and the `finish` events.
Also clarifies the wording on the `end` event.
2014-05-21 16:48:46 -07:00
Nikolai Vavilov
79e8f65cb1 doc: fix a typo
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-05-07 14:41:15 -07:00
Vladimir Kurchatkin
d0fc5538d1 stream: split objectMode for Duplex
This commit introduces `readableObjectMode` and
`writableObjectMode` options for Duplex streams.
This can be used mostly to make parsers and
serializers with Transform streams.

Also the docs section about stream state objects
is removed, because it is not relevant anymore.
The example from the section is remade to show
new options.

fixes #6284

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
2014-04-30 10:44:31 -07:00