Minor rewording related to making a server listen to a random port,
and added how to retrieve which port was randomly chosen by the OS.
Also changed documented `server.listen()` signature as it does in fact
not require `port` to be provided.
PR-URL: https://github.com/nodejs/node/pull/7976
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Use blockquotes instead of code blocks for stability markers in
the docs. Doing that:
- Makes the makers appear correctly when viewed e.g. on github.
- Allows remark-lint rules like `no-undefined-references` to work
properly (https://github.com/nodejs/node/pull/7729).
PR-URL: https://github.com/nodejs/node/pull/7757
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
The default encoding for crypto methods was changed in v6.0.0
with v4.x keeping a default of binary.
PR-URL: https://github.com/nodejs/node/pull/7805
Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Classes cannot be instantiated without new, but util.deprecate()
uses Function.prototype.apply(). This commit uses new.target to
detect constructor calls, allowing classes to be deprecated.
PR-URL: https://github.com/nodejs/node/pull/7690
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
As discussed and agreed upon by the CTC, the punycode module bundled
in core is soft-deprecated (docs only) for v7 with an eye towards
hard-deprecation in v8 or later.
Also see discussion in https://github.com/nodejs/node/pull/7552
PR-URL: https://github.com/nodejs/node/pull/7941
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Single quotes in two of the examples were throwing off the
formatting of the path documentation on the Node.js website. This
commit expands two contractions to remove the offending quotes.
PR-URL: https://github.com/nodejs/node/pull/7817
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/7915
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Node process will no longer terminate with an assertion if the
inspector port is not available.
PR-URL: https://github.com/nodejs/node/pull/7874
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/7885
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
`NODE_REPL_HISTORY` was introduced in v3.0.0
(see e.g. 6faf17cb45).
PR-URL: https://github.com/nodejs/node/pull/7775
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
This commit adds more links and reuses existing link references more.
PR-URL: https://github.com/nodejs/node/pull/7784
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This commit adds more links and separates internal doc links
from external web links.
PR-URL: https://github.com/nodejs/node/pull/7784
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This commit allows child_process.fork() to pass stdio options
to spawn(). This allows fork() to more easily take advantage of
additional stdio channels.
Refs: https://github.com/nodejs/node-v0.x-archive/issues/5727
PR-URL: https://github.com/nodejs/node/pull/7811
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Comparing the buffers `ABC` and `ABCD` returns `-1` not `1`.
PR-URL: https://github.com/nodejs/node/pull/7777
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Adds missing semicolons, removes extra white space, and properly indents
various code snippets in the documentation.
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/7745
State in the documentation that `uncaughtException` is not a reliable
way to restart a crashed application, and clarify that an application
may crash in ways that do not trigger this event.
Use a documented synchronous function in example code.
Fixes: https://github.com/nodejs/node/issues/6223
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/6378
Fix small typo in Buffering section of stream doc.
PR-URL: https://github.com/nodejs/node/pull/7738
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
The name 'event' for the argument of the listener in
fs.watch was confusing considering FSWatcher also had
events. This changes the name of the argument to
eventType.
Fixes: https://github.com/nodejs/node/issues/7504
PR-URL: https://github.com/nodejs/node/pull/7506
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
* Fix markdown code sample in releases.md, it was <a id="x.y.x></a>"
* Fix some markdown errors, e.g. in changelogs
* Fix broken defs links, e.g. in domain-postmortem.md
* Fix other broken refs, by addaleax
* Add links to some defs that were present but not linked to
* Remove dead defs
* Move defs to the bottom (one file affected)
* Add language indicators to all code blocks, using `txt` when no
specific language could be chosen
* Some minor formatting changes (spaces, ident, headings)
PR-URL: https://github.com/nodejs/node/pull/7637
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
Hopefully clarify the behaviour of `buffer.indexOf()` and
`buffer.includes()` for numbers in that they will be
truncated to uint8s.
Add tests for that behaviour.
Fixes: https://github.com/nodejs/node/issues/7591
PR-URL: https://github.com/nodejs/node/pull/7611
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
The arguments object is not created for arrow functions so the example
was incorrect.
PR-URL: https://github.com/nodejs/node/pull/7674
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/7670
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
The dns.resolve documentation stated that an array of IP
addresses would be returned in the callback. This is true
for everything other than the SOA record which returns an object.
This fixes that documentation.
Fixes: https://github.com/nodejs/node/issues/6506
PR-URL: https://github.com/nodejs/node/pull/7532
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
Adding membership using `IP_ADD_MEMBERSHIP` with interface address set
to `INADDR_ANY` for `IPv4` or as an index of `0` for `IPv6` leads to
using only one interface selected by the operating system.
Fixes: https://github.com/nodejs/node/issues/1692
PR-URL: https://github.com/nodejs/node/pull/7244
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit adds a breakLength option to util.inspect(). This
option allows users to control the length at which object keys
are split across multiple lines. For backwards compatibility,
this option defaults to 60.
Fixes: https://github.com/nodejs/node/issues/7305
PR-URL: https://github.com/nodejs/node/pull/7499
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
The current documentation states that if run something like
`node app.js` then in our process.argv array first elements is `node`,
but actually it's `process.execPath` not `node`
as documentation currently suggests.
Fixes: https://github.com/nodejs/node/issues/7434
PR-URL: https://github.com/nodejs/node/pull/7449
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/7466
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Bryan English <bryan@bryanenglish.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/7485
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Overall improvements to timers.md documentation,
Includes squashed commit from @bengl:
doc: add timer classes
The timers returned by `setTimeout` and friends are
actually instances of `Timeout` and `Immediate`.
Documenting them as such, so that the `ref` and
`unref` methods can be identified as methods on
`Timeout` objects.
Sparked by discussion in #5792
PR-URL: https://github.com/nodejs/node/pull/6937
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
Reviewed-By: Bryan English <bryan@bryanenglish.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* Speed up buffer.swap16 and swap32 by using builtins. Up to ~6x gain.
Drop transition point between JS and C++ implementations accordingly.
Amount of performance improvement not only depends on buffer size but
also memory alignment.
* Fix tests: C++ impl tests were testing 0-filled buffers so were
always passing.
* Add similar buffer.swap64 method.
* Make buffer-swap benchmark mirror JS impl.
doc/api/buffer.markdown has an entry of "added: REPLACEME" that should
be changed to the correct release number before tagged.
Because node is currently using a very old version of cpplint.py it
doesn't know that std::swap() has moved from <algorithm> to <utility> in
c++11. So until cpplint.py is updated simply NOLINT the line.
Technically it should be NOLINT(build/include_what_you_use), but that
puts the line over 80 characters causing another lint error.
PR-URL: https://github.com/nodejs/node/pull/7157
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
An apostrophe was being used where a backtick was called for, resulting
in improper rendering.
PR-URL: https://github.com/nodejs/node/pull/7431
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Ingvar Stepanyan <me@rreverser.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Fix typo in example
PR-URL: https://github.com/nodejs/node/pull/7411
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Previously, one would have to call setPrompt after calling
rl.createInterface. Now, the prompt string can be set by passing the
prompt property.
PR-URL: https://github.com/nodejs/node/pull/7125
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
- Adds the `breakEvalOnSigint` option to `vm.runIn(This)Context`.
This uses a watchdog thread to wait for SIGINT and generally works
just like the existing `timeout` option.
- Adds a method to the existing timer-based watchdog to check if it
stopped regularly or by running into the timeout. This is used to
tell a SIGINT abort from a timer-based one.
- Adds (internal) `process._{start,stop}SigintWatchdog` methods to
start/stop the watchdog thread used by the above option manually.
This will be used in the REPL to set up SIGINT handling before
entering terminal raw mode, so that there is no time window in
which Ctrl+C fully aborts the process.
PR-URL: https://github.com/nodejs/node/pull/6635
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit removes an extraneous word.
PR-URL: https://github.com/nodejs/node/pull/7329
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
As the description in http.md:
> If the body contains higher coded characters then
Buffer.byteLength() should be used to determine the number of
bytes in a given encoding.
PR-URL: https://github.com/nodejs/node/pull/7274
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jackson Tian <shyvo1987@gmail.com>
zlib constants were previously being added to binding in node_zlib.cc.
This moves the zlib constants to node_constants.cc for consistency with
the recent constants refactoring:
https://github.com/nodejs/node/pull/6534
Adds require('zlib').constants to expose the constants
Docs-only deprecates the constants hung directly off require('zlib')
Removes a couple constants from the docs that apparently no longer
exist in the code
PR-URL: https://github.com/nodejs/node/pull/7203
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Clarify that using a port value of `0` will result in the operating
system identifying an available port for use.
PR-URL: https://github.com/nodejs/node/pull/7206
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
cluster.setupMaster() can be called more than once. Core even has
tests for this functionality. This commit removes an incorrect
statement to the contrary from the documentation.
Fixes: https://github.com/nodejs/node/issues/7156
PR-URL: https://github.com/nodejs/node/pull/7179
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
A message stuck around in the native API warning users to not use 'raw'
encoding. Followed by an abort(). This is no longer necessary since all
other signs of 'raw' encoding have been removed.
PR-URL: https://github.com/nodejs/node/pull/7111
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
When node began using the OneByte API (f150d56) it also switched to
officially supporting ISO-8859-1. Though at the time no new encoding
string was introduced.
Introduce the new encoding string 'latin1' to be more explicit. The
previous 'binary' and documented as an alias to 'latin1'. While many
tests have switched to use 'latin1', there are still plenty that do both
'binary' and 'latin1' checks side-by-side to ensure there is no
regression.
PR-URL: https://github.com/nodejs/node/pull/7111
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
In prose, always surround `null`-as-a-value in backticks.
PR-URL: https://github.com/nodejs/node/pull/6986
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
The repl documentation has always been rather lacking. This is
a first step towards making significant improvements.
PR-URL: https://github.com/nodejs/node/pull/7002
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Got the information from git history, I added the version when Interface
was exported as class (v0.1.104), it was an internal class on previous
versions.
Refs: https://github.com/nodejs/node/issues/6578
PR-URL: https://github.com/nodejs/node/pull/6996
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
`stdout` was written as `inline code` most of the time,
except for the `console.time` and `console.timeEnd`
functions which made it a bit more tedious to read about.
Now it's always using inline code.
PR-URL: https://github.com/nodejs/node/pull/7062
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This is maybe more verbose than needed, since the same information is
repeated several times. An alternative, maybe a single short sentence at
the beginning is better. E.g.
Fixes: https://github.com/nodejs/node/issues/7110
PR-URL: https://github.com/nodejs/node/pull/7113
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Majoring restructuring and update for streams doc.
This is the first step of multiple to updating and
correcting the streams documentation.
PR-URL: https://github.com/nodejs/node/pull/6947
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Got the information from git history and I ignored previous version of
dns attached to `node.dns` (pre v0.1.16).
There is a case where `dns.resolveNaptr` were intented to be in v0.7.12 and
it was reverted and addec back on `v0.9.12`, I left the latest version
when module was introduced. Same for `dns.resolvePtr` who was referenced
before but it was only added on `v6.0.0`
Refs: https://github.com/nodejs/node/issues/6578
PR-URL: https://github.com/nodejs/node/pull/7021
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
As requested in earlier PR adding detail for Aix, add link
for each of the platform specific technologies used for
file system watching.
PR-URL: https://github.com/nodejs/node/pull/7071
Reviewed-By: Robert Jefe Lindstädt <robert.lindstaedt@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
OS X has a tiny 1kb hard-coded buffer size for stdout / stderr to
TTYs (terminals). Output larger than that causes chunking, which ends
up having some (very small but existent) delay past the first chunk.
That causes two problems:
1. When output is written to stdout and stderr at similar times, the
two can become mixed together (interleaved). This is especially
problematic when using control characters, such as \r. With
interleaving, chunked output will often have lines or characters erased
unintentionally, or in the wrong spots, leading to broken output.
CLI apps often extensively use such characters for things such as
progress bars.
2. Output can be lost if the process is exited before chunked writes
are finished flushing. This usually happens in applications that use
`process.exit()`, which isn't infrequent.
See https://github.com/nodejs/node/issues/6980 for more info.
This became an issue as result of the Libuv 1.9.0 upgrade. A fix to
an unrelated issue broke a hack previously required for the OS X
implementation. This resulted in an unexpected behavior change in node.
The 1.9.0 upgrade was done in c3cec1eefc,
which was included in v6.0.0.
Full details of the Libuv issue that induced this are at
https://github.com/nodejs/node/issues/6456#issuecomment-219974514
Refs: https://github.com/nodejs/node/pull/1771
Refs: https://github.com/nodejs/node/issues/6456
Refs: https://github.com/nodejs/node/pull/6773
Refs: https://github.com/nodejs/node/pull/6816
PR-URL: https://github.com/nodejs/node/pull/6895
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
- Only `@@toStringTag` affects `util.isError()`, this is the reason why
it uses `Object.prototype.toString.call(argument)` under the hood.
- Shows an actual Euro symbol for reference.
- Uses line-drawing characters for the URL chart & fixes the chart
borders.
PR-URL: https://github.com/nodejs/node/pull/7026
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This change introduces experimental v8-inspector support. This brings
the DevTools debug protocol allowing Node.js to be debugged with
Chrome DevTools native, or through other debuggers supporting that
protocol.
Partial WebSocket support, to the extent required by DevTools, is
included. This is derived from the implementation in Blink.
v8-inspector support can be disabled by the --without-inspector
configure flag.
PR-URL: https://github.com/nodejs/node/pull/6792
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: addaleax - Anna Henningsen <anna@addaleax.net>
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/nodejs/node/pull/7007
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>