Граф коммитов

2596 Коммитов

Автор SHA1 Сообщение Дата
cjihrig 3de9bc9429 readline: document emitKeypressEvents()
This commit adds documentation to the already publicly available
readline.emitKeypressEvents() method.

PR-URL: https://github.com/nodejs/node/pull/6024
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2016-04-05 10:48:47 -04:00
Rich Trott 539cede426 doc: note assert.throws() pitfall
PR-URL: https://github.com/nodejs/node/pull/6029
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-04 09:22:06 -07:00
James M Snell 64bf4b31c6 doc: document unspecified behavior for buf.write* methods
Per https://github.com/nodejs/node/issues/1161, when the
buf.write*() methods are given anything other than what
they expect, indicate that the behavior is unspecified.

Fixes: https://github.com/nodejs/node/issues/1161
PR-URL: https://github.com/nodejs/node/pull/5925
Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
2016-04-03 11:29:23 -07:00
James M Snell 6fd26dcc20 doc: clarify stdout/stderr arguments to callback
Clarify that the arguments to child_process.execFile
and child_process.exec callback can be Buffer or strings.

Fixes: https://github.com/nodejs/node/issues/3389
PR-URL: https://github.com/nodejs/node/pull/6015
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-02 19:37:58 -07:00
firedfox ba0b769c7b doc: add 'Command Line Options' to 'View on single page'
Includes cli.markdown in all.markdown

PR-URL: https://github.com/nodejs/node/pull/6011
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-04-02 17:10:44 -07:00
James M Snell 63e743db38 doc: minor argument formatting in stream.markdown
Fixes: https://github.com/nodejs/node/issues/4350
PR-URL: https://github.com/nodejs/node/pull/6016
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-02 16:39:21 -07:00
James M Snell c06824b4b7 doc: clarify that __dirname is module local
Fixes: https://github.com/nodejs/node/issues/5525
PR-URL: https://github.com/nodejs/node/pull/6018
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-02 16:37:52 -07:00
Bryan English 33003a52d2 doc: consolidate timers docs in timers.markdown
Rather than attempting to keep two versions of docs for timers up to
date, keep them in timers.markdown, and leave references to them in
globals.markdown.

Add setImmediate and clearImmediate to globals.markdown.

Change "To schedule" to "Schedules" in timers.markdown.

PR-URL: https://github.com/nodejs/node/pull/5837
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2016-04-02 14:06:25 -03:00
Robert Jefe Lindstaedt 82c2996e2d doc: refine child_process detach behaviour
this adds an example of a long running node process that actually
executes node code.
Also it mentions the not to harmonic detach behaviours of the
different platforms, whereas detaching on unix requires ignoring
the child_process' stdio explicitely.

PR-URL: https://github.com/nodejs/node/pull/5330
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-01 22:57:08 -07:00
Colin Ihrig 39de601e1c net: support DNS hints in createConnection()
This commit adds support for passing DNS lookup hints to
createConnection().

PR-URL: https://github.com/nodejs/node/pull/6000
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-01 17:03:42 -04:00
firedfox d939152230 doc: fix typo in fs writeSync param list
Rename `buffer` to `data` in param list of
fs.writeSync(fd, data[, position[, encoding]])

PR-URL: https://github.com/nodejs/node/pull/5984
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-01 09:47:36 -07:00
firedfox 4039ef1a58 doc: remove redundant parameter comments from fs
Some old version parameter comments are left in fs.markdown. Remove
them.

PR-URL: https://github.com/nodejs/node/pull/5952
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Robert Lindstädt <robert.lindstaedt@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-03-31 00:28:52 +02:00
Jackson Tian 293fd04535 buffer: make byteLength work with ArrayBuffer & DataView
Convert anything to string, but Buffer, TypedArray and ArrayBuffer

```
var uint8 = new Uint8Array([0xf0, 0x9f, 0x90]);
Buffer.byteLength(uint8); // should be 3, but returns 11
Buffer.byteLength(uint8.buffer); // should be 3, but return 20
```

PR-URL: https://github.com/nodejs/node/pull/5255
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-27 09:19:39 -07:00
ghaiklor 1213535701 doc: fix doc for Buffer.readInt32LE()
Update example of readInt32LE method. buf.readInt32LE(1) is supposed to
throw an error as it has only four elements and it tries to read 32
bits from three bytes.

Fixes: https://github.com/nodejs/node/issues/5889
PR-URL: https://github.com/nodejs/node/pull/5890
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2016-03-27 12:21:09 +05:30
James M Snell 060e5f0c00 fs: Buffer and encoding enhancements to fs API
This makes several changes:

1. Allow path/filename to be passed in as a Buffer on fs methods
2. Add `options.encoding` to fs.readdir, fs.readdirSync, fs.readlink,
   fs.readlinkSync and fs.watch.
3. Documentation updates

For 1... it's now possible to do:

```js
fs.open(Buffer('/fs/foo/bar'), 'w+', (err, fd) => { });
```

For 2...
```js
fs.readdir('/fs/foo/bar', {encoding:'hex'}, (err,list) => { });

fs.readdir('/fs/foo/bar', {encoding:'buffer'}, (err, list) => { });
```

encoding can also be passed as a string

```js
fs.readdir('/fs/foo/bar', 'hex', (err,list) => { });
```

The default encoding is set to UTF8 so this addresses the
discrepency that existed previously between fs.readdir and
fs.watch handling filenames differently.

Fixes: https://github.com/nodejs/node/issues/2088
Refs: https://github.com/nodejs/node/issues/3519
PR-URL: https://github.com/nodejs/node/pull/5616
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-03-25 14:21:27 -07:00
James M Snell 4d4f3535a9 doc: general improvements to fs.markdown
PR-URL: https://github.com/nodejs/node/pull/5616
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-03-25 14:21:23 -07:00
Jeremiah Senkpiel be68b68d48 doc: add instructions to only sign a release
PR-URL: https://github.com/nodejs/node/pull/5876
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-24 21:25:23 -07:00
James M Snell c6656db352 process: add 'warning' event and process.emitWarning()
In several places throughout the code we write directly to stderr
to report warnings (deprecation, possible eventemitter memory leak).
The current design of simply dumping the text to stderr is less
than ideal. This PR introduces a new "process warnings" mechanism
that emits 'warning' events on the global process object. These are
invoked with a `warning` argument whose value is an Error object.

By default, these warnings will be printed to stderr. This can be
suppressed using the `--no-warnings` and `--no-deprecation` command
line flags. For warnings, the 'warning' event will still be emitted
by the process, allowing applications to handle the warnings in custom
ways. The existing `--no-deprecation` flag will continue to supress
all deprecation output generated by the core lib.

The `--trace-warnings` command line flag will tell Node.js to print
the full stack trace of warnings as part of the default handling.

The existing `--no-deprecation`, `--throw-deprecation` and
`--trace-deprecation` flags continue to work as they currently do,
but the exact output of the warning message is modified to occur
on process.nextTick().

The stack trace for the warnings and deprecations preserve and point
to the correct call site.

A new `process.emitWarning()` API is provided to permit userland
to emit warnings and deprecations using the same consistent
mechanism.

Test cases and documentation are included.

PR-URL: https://github.com/nodejs/node/pull/4782
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-03-24 13:19:11 -07:00
Benjamin Gruenbaum ea52f47790 doc: use consistent event name parameter
Implementing the suggestion in
https://github.com/nodejs/node/issues/4554 this pull request renames
the parameter name in all the places that accept an event name as a parameter.

Previously, the parameter has been called `event` or `type`. Now as suggested
it is consistently called `eventName`.

PR-URL: https://github.com/nodejs/node/pull/5850
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-03-24 15:26:37 +02:00
James M Snell f429fe1b88 crypto: fail early when loading crypto without openssl
Fail early in require('crypto'), require('tls'),
require('https'), etc when crypto is not available
(rather than depending on an internal try/catch).

Add documentation for detecting when crypto is not available.

PR-URL: https://github.com/nodejs/node/pull/5611
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-03-23 10:34:40 -07:00
James M Snell 7d73e60f60 buffer: add swap16() and swap32() methods
Adds Buffer.prototype.swap16() and Buffer.prototype.swap32()
methods that mutate the Buffer instance in-place by swapping the
16-bit and 32-bit byte-order.

Example:

```js
const buf = Buffer([0x1, 0x2, 0x3, 0x4]);
buf.swap16();
console.log(buf);
  // prints Buffer(0x2, 0x1, 0x4, 0x3);

buf.swap32();
console.log(buf);
  // prints Buffer(0x3, 0x4, 0x1, 0x2);
```

PR-URL: https://github.com/nodejs/node/pull/5724
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-03-23 08:52:44 -07:00
John Eversole d16d9047ea doc: explain path.format expected properties
Explain the expected properties in path.format

Fixes: https://github.com/nodejs/node/issues/5746
PR-URL: https://github.com/nodejs/node/pull/5801
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2016-03-22 23:46:33 +02:00
Corey Kosak e301f979de doc: typo: interal->internal.
Fixes a copy typo in the events.md docs.

PR-URL: https://github.com/nodejs/node/pull/5849
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-22 23:26:27 +02:00
Tom Gallacher 03e07d32ac src: override v8 thread defaults using cli options
Based on the conversation in #4243 this implements a way to increase
and decrease the size of the thread pool used in v8.

Currently v8 restricts the thread pool size to `kMaxThreadPoolSize`
which at this commit is (4). So it is only possible to
decrease the thread pool size at the time of this commit. However with
changes upstream this could change at a later date.
If set to 0 then v8 would choose an appropriate size of the thread pool
based on the number of online processors.

PR-URL: https://github.com/nodejs/node/pull/4344
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-03-22 07:55:53 -07:00
Bill Automata e136c179c1 doc: update crypto docs to use good defaults
[Diffie-Hellman](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange#Cryptographic_explanation)
keys are composed of a `generator` a `prime` a `secret_key`
and the `public_key` resulting from the math operation:

```
(generator ^ secret_key) mod prime = public_key
```

Diffie-Hellman keypairs will compute a matching shared secret
if and only if the generator and prime match for both
recipients.  The generator is usually **2** and the prime is
what is called a [Safe Prime](https://en.wikipedia.org/wiki/Safe_prime).

Usually this matching is accomplished by using
[standard published groups](http://tools.ietf.org/html/rfc3526).
We expose access those groups with the `crypto.getDiffieHellman`
function.

`createDiffieHellman` is trickier to use.  The original example
had the user creating 11 bit keys, and creating random groups of
generators and primes. 11 bit keys are very very small, can be
cracked by a single person on a single sheet of paper.  A
byproduct of using such small keys were that it was a high
likelihood that two calls of `createDiffieHellman(11)` would
result in using the same 11 bit safe prime.

The original example code would fail when the safe primes generated
at 11 bit lengths did not match for alice and bob.

If you want to use your own generated safe `prime` then the proper
use of `createDiffieHellman` is to pass the `prime` and `generator`
to the recipient's constructor, so that when they compute the shared
secret their `prime` and `generator` match, which is fundamental to
the algorithm.

PR-URL: https://github.com/nodejs/node/pull/5505
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-21 16:49:46 -07:00
Rod Vagg bac6c85056 doc: add CTC meeting minutes 2016-02-10
PR-URL: https://github.com/nodejs/node/pull/5273
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-21 15:54:35 -07:00
Rod Vagg 5aebbaeb49 doc: add CTC meeting minutes 2016-02-03
PR-URL: https://github.com/nodejs/node/pull/5272
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-21 15:53:26 -07:00
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
Wolfgang Steiner f70c71f168 doc: explain error message on missing main file
Added a hint saying that node uses the default "Cannot find module"
error when requiring a module for which the "main" file specified in
the package.json is missing.

PR-URL: https://github.com/nodejs/node/pull/5812
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-21 14:59:13 -07:00
Jeremiah Senkpiel 91cf55ba8e doc: add a cli options doc page
This page is mostly a mirror of the updated manual page.

PR-URL: https://github.com/nodejs/node/pull/5787
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell jasnell@gmail.com>
Reviewed-By: Bryan English <bryan@bryanenglish.com>
Reviewed-By: Robert Lindstädt <robert.lindstaedt@gmail.com>
2016-03-21 17:33:42 -04:00
Mithun Patel 54e6a8d6d7 doc: Add windows example for Path.format
PR-URL: https://github.com/nodejs/node/pull/5700
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2016-03-21 09:11:56 -07:00
Bryan English 0fd3327879 doc: grammar, clarity and links in timers doc
Added appropriate in-document links. Clarified a bit of
`setImmediate`, including a quick grammar fix (plural possessive
apostrophe).

PR-URL: https://github.com/nodejs/node/pull/5792
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2016-03-21 09:48:54 +02:00
Florian MARGAINE e5f8a6a2fa fs: add the fs.mkdtemp() function.
This uses libuv's mkdtemp function to provide a way to create a
temporary folder, using a prefix as the path. The prefix is appended
six random characters. The callback function will receive the name
of the folder that was created.

Usage example:

fs.mkdtemp('/tmp/foo-', function(err, folder) {
    console.log(folder);
        // Prints: /tmp/foo-Tedi42
});

The fs.mkdtempSync version is also provided. Usage example:

console.log(fs.mkdtemp('/tmp/foo-'));
    // Prints: tmp/foo-Tedi42

This pull request also includes the relevant documentation changes
and tests.

PR-URL: https://github.com/nodejs/node/pull/5333
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-20 11:49:02 +02:00
Stefano Vozza 4f6ad5c1dd doc: align doc/api/tls.markdown with style guide
Brings tls.markdown into alignment with the node.js
styleguide, specifically regarding the use of
personal pronouns. Also, fixes various typos,
punctuation errors, missing definite/indefinite
articles and other minor grammatical issues.

PR-URL: https://github.com/nodejs/node/pull/5706
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-20 10:42:04 +02:00
Jarrett Widman 5f1eb434ee doc: topic blocking vs non-blocking
The need for an overview of blocking vs non-blocking was
identified in the docs WG Q1 roadmap. As there are several
topics also pending creation, this one tries to hit the correct
level of detail based on completion of the others.  One
which is referenced is
https://github.com/nodejs/node/pull/4936/files and URLs
within this PR need to change based on where that will land
on the node website.

PR-URL: https://github.com/nodejs/node/pull/5326
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2016-03-19 15:19:15 +02:00
Lance Ball ad8257fa5b repl: Assignment of _ allowed with warning
This commit addresses https://github.com/nodejs/node/issues/5431 by
changing the way that the repl handles assignment to the global _
variable.

Prior to this commit, node sets the result of the last expression
evaluated in the repl to `_`. This causes problems for users of
underscore, lodash and other packages where it is common to assign
`_` to the package, e.g. `_ = require('lodash');`.

Changes in this commit now result in the following behavior.

- If unassigned on the repl, `_` continues to refer to the last
  evaluated expression.
- If assigned, the default behavior of assigning `_` to the last
  evaluated expression is disabled, and `_` now references whatever
  value was explicitly set. A warning is issued on the repl -
  'expression assignment to _ now disabled'.
- If `_` is assigned multiple times, the warning is only displayed once.
- When `.clear` is executed in the repl, `_` continues to refer to its
  most recent value, whatever that is (this is per existing behavior).
  If `_` had been explicitly set prior to `.clear` it will not change
  again with the evaluation of the next expression.

PR-URL: https://github.com/nodejs/node/pull/5535
Fixes: https://github.com/nodejs/node/issues/5431
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-18 21:03:40 +01:00
Andrea Giammarchi ac6af73a6d doc: fix typo in synchronous randomBytes example
The string template was closed after `${buf.length}`
causing a syntax error within the example.

PR-URL: https://github.com/nodejs/node/pull/5781
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-18 10:54:21 -07:00
HUANG Wei 545b8fd8d8 net: emit host in lookup event
Previously, we emitted ip and addressType. This change includes the host
as the last argument to the lookup event.

PR-URL: https://github.com/nodejs/node/pull/5598
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-03-18 11:04:02 -05:00
Brian White 08085c49b6 path: assert inputs are strings
This commit makes input type checking consistent across all path
functions.

PR-URL: https://github.com/nodejs/node/pull/5348
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-03-17 23:20:12 -04:00
Brian White af09a9cc1b doc: fix crypto update() signatures
PR-URL: https://github.com/nodejs/node/pull/5500
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
2016-03-17 22:30:20 -04:00
Claudio Rodriguez 929b5b92a5 doc: fix multiline return comments in querystring
Changes the multiline return example commments in querystring
which have the example out-of-comment, into single comment
lines to remain consistent with other docs.

PR-URL: https://github.com/nodejs/node/pull/5705
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2016-03-17 17:15:06 -03:00
Rich Trott 9eb0ef4c2c doc: fix invalid path doc comments
The format of certain code comments in the `path` documentation results
in the code blocks being invalid. I also find it confusing at least as
formatted on the website. This change is intended to improve those
comments.

PR-URL: https://github.com/nodejs/node/pull/5670
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-03-16 21:14:04 -07:00
Rich Trott a97dfa0027 doc: explain path.format() algorithm
PR-URL: https://github.com/nodejs/node/pull/5688
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Fixes: https://github.com/nodejs/node/issues/2305
2016-03-16 14:59:47 -07:00
Benjamin Gruenbaum d8290286b3 doc: document deprecation of util._extend
Document that util._extend was never intended to be used
and should be considered deprecated.

PR-URL: https://github.com/nodejs/node/pull/4903
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-03-16 12:55:55 -07:00
Felix Böhm 939d6efe0f doc: fix return value of write methods
Fixes: https:github.com/nodejs/node/issues/5682
PR-URL: https://github.com/nodejs/node/pull/5736
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2016-03-16 12:40:19 -07:00
Jeremiah Senkpiel f9e6191f85 doc: reformat & improve node.1 manual page
Uses better troff formatting.
Removes v8 options from the man page.

Also edits `node -h` in node.cc slightly.

PR-URL: https://github.com/nodejs/node/pull/5497
Reviewed-By: James Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2016-03-16 13:49:40 -04:00
James M Snell 85ab4a5f12 buffer: add .from(), .alloc() and .allocUnsafe()
Several changes:

* Soft-Deprecate Buffer() constructors
* Add `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()`
* Add `--zero-fill-buffers` command line option
* Add byteOffset and length to `new Buffer(arrayBuffer)` constructor
* buffer.fill('') previously had no effect, now zero-fills
* Update the docs

PR-URL: https://github.com/nodejs/node/pull/4682
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2016-03-16 08:34:02 -07:00
Rich Trott 6ba5af2c2c console: check that stderr is writable
`Console` constructor checks that `stdout.write()` is a function but
does not do an equivalent check for `stderr.write()`. If `stderr` is not
specified in the constructor, then `stderr` is set to be `stdout`.
However, if `stderr` is specified, but `stderr.write()` is not a
function, then an exception is not thrown until `console.error()` is
called.

This change adds the same check for 'stderr' in the constructor that is
there for `stdout`. If `stderr` fails the check, then a `TypeError` is
thrown.

Took the opportunity to copyedit the `console` doc a little too.

PR-URL: https://github.com/nodejs/node/pull/5635
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-03-15 19:10:55 -07:00
Mithun Patel 99a5d07935 doc: Add note about use of JSON.stringify()
process.send and child.send use JSON.stringify to serialize
the message.

Fixes: https://github.com/nodejs/node/issues/5453
PR-URL: https://github.com/nodejs/node/pull/5723
Reviewed-By: Jeremy Whitlock <jwhitlock@apache.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-15 09:38:28 -07:00
James M Snell b6e3fa745b events: add eventNames() method
Per https://github.com/nodejs/node/issues/1817, there are many modules
that currently abuse the private `_events` property on EventEmitter.
One of the ways it is used is to determine if a particular event is
being listened for. This adds a simple `eventNames()` method that
returns an array of the events with currently registered listeners.

PR-URL: https://github.com/nodejs/node/pull/5617
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2016-03-15 09:25:35 -07:00