diff --git a/doc/STYLE_GUIDE.md b/doc/STYLE_GUIDE.md index 8dbc1412a97dad..5a05544d931bee 100644 --- a/doc/STYLE_GUIDE.md +++ b/doc/STYLE_GUIDE.md @@ -59,8 +59,16 @@ * References to constructor instances should use camelCase. * References to methods should be used with parentheses: for example, `socket.end()` instead of `socket.end`. +* Function arguments or object properties should use the following format: + * * \`name\` {type|type2} Optional description. \*\*Default:\*\* \`defaultValue\` + * E.g. * `byteOffset` {integer} Index of first byte to expose. **Default:** `0` + * The `type` should refer to a Node.js type or a [JavaScript type][] +* Function returns should use the following format: + * * Returns: {type|type2} Optional description. + * E.g. * Returns: {AsyncHook} A reference to `asyncHook`. -[plugin]: http://editorconfig.org/#download -[Oxford comma]: https://en.wikipedia.org/wiki/Serial_comma [Em dashes]: https://en.wikipedia.org/wiki/Dash#Em_dash +[Javascript type]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Data_structures_and_types +[Oxford comma]: https://en.wikipedia.org/wiki/Serial_comma [The New York Times Manual of Style and Usage]: https://en.wikipedia.org/wiki/The_New_York_Times_Manual_of_Style_and_Usage +[plugin]: http://editorconfig.org/#download diff --git a/doc/api/addons.md b/doc/api/addons.md index b17c1c9e5c51c7..17811245f1c23e 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -1040,8 +1040,8 @@ has ended but before the JavaScript VM is terminated and Node.js shuts down. #### void AtExit(callback, args) -* `callback`: `void (*)(void*)` - A pointer to the function to call at exit. -* `args`: `void*` - A pointer to pass to the callback at exit. +* `callback` {void (\*)(void\*)} A pointer to the function to call at exit. +* `args` {void\*} A pointer to pass to the callback at exit. Registers exit hooks that run after the event loop has ended but before the VM is killed. diff --git a/doc/api/assert.md b/doc/api/assert.md index b742e69d7fb312..bf69de826c521c 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -202,8 +202,8 @@ added: v0.1.21 * `actual` {any} * `expected` {any} * `message` {any} -* `operator` {string} (default: '!=') -* `stackStartFunction` {function} (default: `assert.fail`) +* `operator` {string} **Default:** '!=' +* `stackStartFunction` {function} **Default:** `assert.fail` Throws an `AssertionError`. If `message` is falsy, the error message is set as the values of `actual` and `expected` separated by the provided `operator`. diff --git a/doc/api/buffer.md b/doc/api/buffer.md index de92be481d4b16..22ea45d255b312 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -160,7 +160,7 @@ console.log(buf.toString('base64')); The character encodings currently supported by Node.js include: -* `'ascii'` - for 7-bit ASCII data only. This encoding is fast and will strip +* `'ascii'` - For 7-bit ASCII data only. This encoding is fast and will strip the high bit if set. * `'utf8'` - Multibyte encoded Unicode characters. Many web pages and other @@ -304,7 +304,7 @@ deprecated: v6.0.0 > Stability: 0 - Deprecated: Use [`Buffer.from(array)`] instead. -* `array` {Array} An array of bytes to copy from +* `array` {integer[]} An array of bytes to copy from. Allocates a new `Buffer` using an `array` of octets. @@ -322,7 +322,7 @@ deprecated: v6.0.0 > Stability: 0 - Deprecated: Use [`Buffer.from(buffer)`] instead. -* `buffer` {Buffer} An existing `Buffer` to copy data from +* `buffer` {Buffer} An existing `Buffer` to copy data from. Copies the passed `buffer` data onto a new `Buffer` instance. @@ -393,7 +393,7 @@ deprecated: v6.0.0 > Stability: 0 - Deprecated: Use [`Buffer.alloc()`] instead (also see > [`Buffer.allocUnsafe()`]). -* `size` {integer} The desired length of the new `Buffer` +* `size` {integer} The desired length of the new `Buffer`. Allocates a new `Buffer` of `size` bytes. The `size` must be less than or equal to the value of [`buffer.kMaxLength`]. Otherwise, a [`RangeError`] is thrown. @@ -426,7 +426,7 @@ deprecated: v6.0.0 > Stability: 0 - Deprecated: > Use [`Buffer.from(string[, encoding])`][`Buffer.from(string)`] instead. -* `string` {string} String to encode +* `string` {string} String to encode. * `encoding` {string} The encoding of `string`. **Default:** `'utf8'` Creates a new `Buffer` containing the given JavaScript string `string`. If @@ -455,7 +455,7 @@ console.log(buf2.toString()); added: v5.10.0 --> -* `size` {integer} The desired length of the new `Buffer` +* `size` {integer} The desired length of the new `Buffer`. * `fill` {string|Buffer|integer} A value to pre-fill the new `Buffer` with. **Default:** `0` * `encoding` {string} If `fill` is a string, this is its encoding. @@ -512,7 +512,7 @@ A `TypeError` will be thrown if `size` is not a number. added: v5.10.0 --> -* `size` {integer} The desired length of the new `Buffer` +* `size` {integer} The desired length of the new `Buffer`. Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must be less than or equal to the value of [`buffer.kMaxLength`]. Otherwise, a @@ -558,7 +558,7 @@ additional performance that [`Buffer.allocUnsafe()`] provides. added: v5.12.0 --> -* `size` {integer} The desired length of the new `Buffer` +* `size` {integer} The desired length of the new `Buffer`. Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The `size` must be less than or equal to the value of [`buffer.kMaxLength`]. @@ -612,10 +612,10 @@ added: v0.1.90 --> * `string` {string|Buffer|TypedArray|DataView|ArrayBuffer} A value to - calculate the length of + calculate the length of. * `encoding` {string} If `string` is a string, this is its encoding. **Default:** `'utf8'` -* Returns: {integer} The number of bytes contained within `string` +* Returns: {integer} The number of bytes contained within `string`. Returns the actual byte length of a string. This is not the same as [`String.prototype.length`] since that returns the number of *characters* in @@ -670,9 +670,9 @@ console.log(arr.sort(Buffer.compare)); added: v0.7.11 --> -* `list` {Array} List of `Buffer` instances to concat +* `list` {Array} List of `Buffer` instances to concat. * `totalLength` {integer} Total length of the `Buffer` instances in `list` - when concatenated + when concatenated. * Returns: {Buffer} Returns a new `Buffer` which is the result of concatenating all the `Buffer` @@ -785,7 +785,7 @@ A `TypeError` will be thrown if `arrayBuffer` is not an [`ArrayBuffer`]. added: v5.10.0 --> -* `buffer` {Buffer} An existing `Buffer` to copy data from +* `buffer` {Buffer} An existing `Buffer` to copy data from. Copies the passed `buffer` data onto a new `Buffer` instance. @@ -852,7 +852,7 @@ Returns `true` if `obj` is a `Buffer`, `false` otherwise. added: v0.9.1 --> -* `encoding` {string} A character encoding name to check +* `encoding` {string} A character encoding name to check. * Returns: {boolean} Returns `true` if `encoding` contains a supported character encoding, or `false` @@ -901,7 +901,7 @@ console.log(buf.toString('ascii')); added: v0.11.13 --> -* `target` {Buffer} A `Buffer` to compare to +* `target` {Buffer} A `Buffer` to compare to. * `targetStart` {integer} The offset within `target` at which to begin comparison. **Default:** `0` * `targetEnd` {integer} The offset with `target` at which to end comparison @@ -1056,7 +1056,7 @@ for (const pair of buf.entries()) { added: v0.11.13 --> -* `otherBuffer` {Buffer} A `Buffer` to compare to +* `otherBuffer` {Buffer} A `Buffer` to compare to. * Returns: {boolean} Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes, @@ -1081,12 +1081,12 @@ console.log(buf1.equals(buf3)); added: v0.5.0 --> -* `value` {string|Buffer|integer} The value to fill `buf` with -* `offset` {integer} Where to start filling `buf`. **Default:** `0` +* `value` {string|Buffer|integer} The value to fill `buf` with. +* `offset` {integer} Number of bytes to skip before starting to fill `buf`. **Default:** `0` * `end` {integer} Where to stop filling `buf` (not inclusive). **Default:** [`buf.length`] * `encoding` {string} If `value` is a string, this is its encoding. **Default:** `'utf8'` -* Returns: {Buffer} A reference to `buf` +* Returns: {Buffer} A reference to `buf`. Fills `buf` with the specified `value`. If the `offset` and `end` are not given, the entire `buf` will be filled. This is meant to be a small simplification to @@ -1118,11 +1118,11 @@ console.log(Buffer.allocUnsafe(3).fill('\u0222')); added: v5.3.0 --> -* `value` {string|Buffer|integer} What to search for +* `value` {string|Buffer|integer} What to search for. * `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0` * `encoding` {string} If `value` is a string, this is its encoding. **Default:** `'utf8'` -* Returns: {boolean} `true` if `value` was found in `buf`, `false` otherwise +* Returns: {boolean} `true` if `value` was found in `buf`, `false` otherwise. Equivalent to [`buf.indexOf() !== -1`][`buf.indexOf()`]. @@ -1159,12 +1159,12 @@ console.log(buf.includes('this', 4)); added: v1.5.0 --> -* `value` {string | Buffer | integer} What to search for +* `value` {string|Buffer|integer} What to search for. * `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0` * `encoding` {string} If `value` is a string, this is its encoding. **Default:** `'utf8'` * Returns: {integer} The index of the first occurrence of `value` in `buf` or `-1` - if `buf` does not contain `value` + if `buf` does not contain `value`. If `value` is: @@ -1238,7 +1238,7 @@ console.log(b.indexOf('b', [])); added: v5.3.0 --> -* `value` {String | Buffer | Integer} What to search for +* `value` {String|Buffer|Integer} What to search for. * `byteOffset` {Integer} Where to begin searching in `buf`. **Default:** `0` * `encoding` {String} If `value` is a string, this is its encoding. **Default:** `'utf8'` @@ -1305,13 +1305,13 @@ for (const key of buf.keys()) { added: v6.0.0 --> -* `value` {string | Buffer | integer} What to search for +* `value` {string|Buffer|integer} What to search for. * `byteOffset` {integer} Where to begin searching in `buf`. **Default:** [`buf.length`]` - 1` * `encoding` {string} If `value` is a string, this is its encoding. **Default:** `'utf8'` * Returns: {integer} The index of the last occurrence of `value` in `buf` or `-1` - if `buf` does not contain `value` + if `buf` does not contain `value`. Identical to [`buf.indexOf()`], except `buf` is searched from back to front instead of front to back. @@ -1431,7 +1431,7 @@ console.log(buf.length); added: v0.11.15 --> -* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 8` +* `offset` {integer} Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. * `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {number} @@ -1467,7 +1467,7 @@ console.log(buf.readDoubleLE(1, true)); added: v0.11.15 --> -* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` +* `offset` {integer} Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 4`. * `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {number} @@ -1502,7 +1502,7 @@ console.log(buf.readFloatLE(1, true)); added: v0.5.0 --> -* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1` +* `offset` {integer} Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 1`. * `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {integer} @@ -1534,7 +1534,7 @@ console.log(buf.readInt8(2)); added: v0.5.5 --> -* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2` +* `offset` {integer} Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 2`. * `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {integer} @@ -1568,7 +1568,7 @@ console.log(buf.readInt16LE(1)); added: v0.5.5 --> -* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` +* `offset` {integer} Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 4`. * `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {integer} @@ -1602,9 +1602,9 @@ console.log(buf.readInt32LE(1)); added: v0.11.15 --> -* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength` -* `byteLength` {integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6` -* `noAssert` {boolean} Skip `offset` and `byteLength` validation? **Default:** `false` +* `offset` {integer} Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - byteLength`. +* `byteLength` {integer} Number of bytes to read. Must satisfy: `0 < byteLength <= 6`. +* `noAssert` {boolean} Skip `offset` and `byteLength` validation? **Default:** `false`. * Returns: {integer} Reads `byteLength` number of bytes from `buf` at the specified `offset` @@ -1634,7 +1634,7 @@ console.log(buf.readIntBE(1, 6).toString(16)); added: v0.5.0 --> -* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1` +* `offset` {integer} Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 1`. * `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {integer} @@ -1664,7 +1664,7 @@ console.log(buf.readUInt8(2)); added: v0.5.5 --> -* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2` +* `offset` {integer} Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 2`. * `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {integer} @@ -1702,7 +1702,7 @@ console.log(buf.readUInt16LE(2).toString(16)); added: v0.5.5 --> -* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` +* `offset` {integer} Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 4`. * `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {integer} @@ -1734,8 +1734,8 @@ console.log(buf.readUInt32LE(1).toString(16)); added: v0.11.15 --> -* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength` -* `byteLength` {integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6` +* `offset` {integer} Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - byteLength`. +* `byteLength` {integer} Number of bytes to read. Must satisfy: `0 < byteLength <= 6`. * `noAssert` {boolean} Skip `offset` and `byteLength` validation? **Default:** `false` * Returns: {integer} @@ -1825,7 +1825,7 @@ console.log(buf.slice(-5, -2).toString()); added: v5.10.0 --> -* Returns: {Buffer} A reference to `buf` +* Returns: {Buffer} A reference to `buf`. Interprets `buf` as an array of unsigned 16-bit integers and swaps the byte-order *in-place*. Throws a `RangeError` if [`buf.length`] is not a multiple of 2. @@ -1855,7 +1855,7 @@ buf2.swap16(); added: v5.10.0 --> -* Returns: {Buffer} A reference to `buf` +* Returns: {Buffer} A reference to `buf`. Interprets `buf` as an array of unsigned 32-bit integers and swaps the byte-order *in-place*. Throws a `RangeError` if [`buf.length`] is not a multiple of 4. @@ -1885,7 +1885,7 @@ buf2.swap32(); added: v6.3.0 --> -* Returns: {Buffer} A reference to `buf` +* Returns: {Buffer} A reference to `buf`. Interprets `buf` as an array of 64-bit numbers and swaps the byte-order *in-place*. Throws a `RangeError` if [`buf.length`] is not a multiple of 8. @@ -2028,11 +2028,11 @@ for (const value of buf) { added: v0.1.90 --> -* `string` {string} String to be written to `buf` -* `offset` {integer} Where to start writing `string`. **Default:** `0` -* `length` {integer} How many bytes to write. **Default:** `buf.length - offset` +* `string` {string} String to be written to `buf`. +* `offset` {integer} Number of bytes to skip before starting to write `string`. **Default:** `0` +* `length` {integer} Number of bytes to write. **Default:** `buf.length - offset` * `encoding` {string} The character encoding of `string`. **Default:** `'utf8'` -* Returns: {integer} Number of bytes written +* Returns: {integer} Number of bytes written. Writes `string` to `buf` at `offset` according to the character encoding in `encoding`. The `length` parameter is the number of bytes to write. If `buf` did not contain @@ -2056,10 +2056,10 @@ console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`); added: v0.11.15 --> -* `value` {number} Number to be written to `buf` -* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 8` +* `value` {number} Number to be written to `buf`. +* `offset` {integer} Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. * `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` -* Returns: {integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written. Writes `value` to `buf` at the specified `offset` with specified endian format (`writeDoubleBE()` writes big endian, `writeDoubleLE()` writes little @@ -2091,10 +2091,10 @@ console.log(buf); added: v0.11.15 --> -* `value` {number} Number to be written to `buf` -* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` +* `value` {number} Number to be written to `buf`. +* `offset` {integer} Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 4`. * `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` -* Returns: {integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written. Writes `value` to `buf` at the specified `offset` with specified endian format (`writeFloatBE()` writes big endian, `writeFloatLE()` writes little @@ -2125,10 +2125,10 @@ console.log(buf); added: v0.5.0 --> -* `value` {integer} Number to be written to `buf` -* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1` +* `value` {integer} Number to be written to `buf`. +* `offset` {integer} Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 1`. * `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` -* Returns: {integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written. Writes `value` to `buf` at the specified `offset`. `value` *should* be a valid signed 8-bit integer. Behavior is undefined when `value` is anything other than @@ -2157,10 +2157,10 @@ console.log(buf); added: v0.5.5 --> -* `value` {integer} Number to be written to `buf` -* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2` +* `value` {integer} Number to be written to `buf`. +* `offset` {integer} Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 2`. * `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` -* Returns: {integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written. Writes `value` to `buf` at the specified `offset` with specified endian format (`writeInt16BE()` writes big endian, `writeInt16LE()` writes little @@ -2190,10 +2190,10 @@ console.log(buf); added: v0.5.5 --> -* `value` {integer} Number to be written to `buf` -* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` +* `value` {integer} Number to be written to `buf`. +* `offset` {integer} Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 4`. * `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` -* Returns: {integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written. Writes `value` to `buf` at the specified `offset` with specified endian format (`writeInt32BE()` writes big endian, `writeInt32LE()` writes little @@ -2223,12 +2223,12 @@ console.log(buf); added: v0.11.15 --> -* `value` {integer} Number to be written to `buf` -* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - byteLength` -* `byteLength` {integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6` +* `value` {integer} Number to be written to `buf`. +* `offset` {integer} Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - byteLength`. +* `byteLength` {integer} Number of bytes to write. Must satisfy: `0 < byteLength <= 6`. * `noAssert` {boolean} Skip `value`, `offset`, and `byteLength` validation? **Default:** `false` -* Returns: {integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written. Writes `byteLength` bytes of `value` to `buf` at the specified `offset`. Supports up to 48 bits of accuracy. Behavior is undefined when `value` is @@ -2258,10 +2258,10 @@ console.log(buf); added: v0.5.0 --> -* `value` {integer} Number to be written to `buf` -* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1` +* `value` {integer} Number to be written to `buf`. +* `offset` {integer} Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 1`. * `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` -* Returns: {integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written. Writes `value` to `buf` at the specified `offset`. `value` *should* be a valid unsigned 8-bit integer. Behavior is undefined when `value` is anything @@ -2290,10 +2290,10 @@ console.log(buf); added: v0.5.5 --> -* `value` {integer} Number to be written to `buf` -* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2` +* `value` {integer} Number to be written to `buf`. +* `offset` {integer} Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 2`. * `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` -* Returns: {integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written. Writes `value` to `buf` at the specified `offset` with specified endian format (`writeUInt16BE()` writes big endian, `writeUInt16LE()` writes little @@ -2327,10 +2327,10 @@ console.log(buf); added: v0.5.5 --> -* `value` {integer} Number to be written to `buf` -* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` +* `value` {integer} Number to be written to `buf`. +* `offset` {integer} Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 4`. * `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` -* Returns: {integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written. Writes `value` to `buf` at the specified `offset` with specified endian format (`writeUInt32BE()` writes big endian, `writeUInt32LE()` writes little @@ -2362,12 +2362,12 @@ console.log(buf); added: v0.5.5 --> -* `value` {integer} Number to be written to `buf` -* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - byteLength` -* `byteLength` {integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6` +* `value` {integer} Number to be written to `buf`. +* `offset` {integer} Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - byteLength`. +* `byteLength` {integer} Number of bytes to write. Must satisfy: `0 < byteLength <= 6`. * `noAssert` {boolean} Skip `value`, `offset`, and `byteLength` validation? **Default:** `false` -* Returns: {integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written. Writes `byteLength` bytes of `value` to `buf` at the specified `offset`. Supports up to 48 bits of accuracy. Behavior is undefined when `value` is @@ -2411,7 +2411,7 @@ Note that this is a property on the `buffer` module as returned by added: v3.0.0 --> -* {integer} The largest size allowed for a single `Buffer` instance +* {integer} The largest size allowed for a single `Buffer` instance. On 32-bit architectures, this value is `(2^30)-1` (~1GB). On 64-bit architectures, this value is `(2^31)-1` (~2GB). @@ -2463,7 +2463,7 @@ deprecated: v6.0.0 > Stability: 0 - Deprecated: Use [`Buffer.allocUnsafeSlow()`] instead. -* `size` {integer} The desired length of the new `SlowBuffer` +* `size` {integer} The desired length of the new `SlowBuffer`. Allocates a new `SlowBuffer` of `size` bytes. The `size` must be less than or equal to the value of [`buffer.kMaxLength`]. Otherwise, a [`RangeError`] is diff --git a/doc/api/child_process.md b/doc/api/child_process.md index c5f5dfe7c515c1..a3d6cf4def7560 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -129,22 +129,22 @@ exec('"my script.cmd" a b', (err, stdout, stderr) => { added: v0.1.90 --> -* `command` {string} The command to run, with space-separated arguments +* `command` {string} The command to run, with space-separated arguments. * `options` {Object} - * `cwd` {string} Current working directory of the child process - * `env` {Object} Environment key-value pairs - * `encoding` {string} (Default: `'utf8'`) - * `shell` {string} Shell to execute the command with - (Default: `'/bin/sh'` on UNIX, `'cmd.exe'` on Windows, The shell should + * `cwd` {string} Current working directory of the child process. + * `env` {Object} Environment key-value pairs. + * `encoding` {string} **Default:** `'utf8'` + * `shell` {string} Shell to execute the command with. + **Default:** `'/bin/sh'` on UNIX, `'cmd.exe'` on Windows. The shell should understand the `-c` switch on UNIX or `/s /c` on Windows. On Windows, - command line parsing should be compatible with `cmd.exe`.) - * `timeout` {number} (Default: `0`) - * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on - stdout or stderr - if exceeded child process is killed (Default: `200*1024`) - * `killSignal` {string|integer} (Default: `'SIGTERM'`) - * `uid` {number} Sets the user identity of the process. (See setuid(2).) - * `gid` {number} Sets the group identity of the process. (See setgid(2).) -* `callback` {Function} called with the output when process terminates + command line parsing should be compatible with `cmd.exe`. + * `timeout` {number} **Default:** `0` + * [`maxBuffer`][] {number} Largest amount of data (in bytes) allowed on + stdout or stderr - if exceeded child process is killed. **Default:** `200*1024` + * `killSignal` {string|integer} **Default:** `'SIGTERM'` + * `uid` {number} Sets the user identity of the process (see setuid(2)). + * `gid` {number} Sets the group identity of the process (see setgid(2)). +* `callback` {Function} Called with the output when process terminates. * `error` {Error} * `stdout` {string|Buffer} * `stderr` {string|Buffer} @@ -209,19 +209,19 @@ replace the existing process and uses a shell to execute the command.* added: v0.1.91 --> -* `file` {string} The name or path of the executable file to run -* `args` {Array} List of string arguments +* `file` {string} The name or path of the executable file to run. +* `args` {string[]} List of string arguments. * `options` {Object} - * `cwd` {string} Current working directory of the child process - * `env` {Object} Environment key-value pairs - * `encoding` {string} (Default: `'utf8'`) - * `timeout` {number} (Default: `0`) - * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on - stdout or stderr - if exceeded child process is killed (Default: `200*1024`) - * `killSignal` {string|integer} (Default: `'SIGTERM'`) - * `uid` {number} Sets the user identity of the process. (See setuid(2).) - * `gid` {number} Sets the group identity of the process. (See setgid(2).) -* `callback` {Function} called with the output when process terminates + * `cwd` {string} Current working directory of the child process. + * `env` {Object} Environment key-value pairs. + * `encoding` {string} **Default:** `'utf8'` + * `timeout` {number} **Default:** `0` + * [`maxBuffer`][] {number} Largest amount of data (in bytes) allowed on + stdout or stderr - if exceeded child process is killed. **Default:*: `200*1024` + * `killSignal` {string|integer} **Default:** `'SIGTERM'` + * `uid` {number} Sets the user identity of the process (see setuid(2)). + * `gid` {number} Sets the group identity of the process (see setgid(2)). +* `callback` {Function} Called with the output when process terminates. * `error` {Error} * `stdout` {string|Buffer} * `stderr` {string|Buffer} @@ -257,24 +257,24 @@ encoding, `Buffer` objects will be passed to the callback instead. added: v0.5.0 --> -* `modulePath` {string} The module to run in the child -* `args` {Array} List of string arguments +* `modulePath` {string} The module to run in the child. +* `args` {Array} List of string arguments. * `options` {Object} - * `cwd` {string} Current working directory of the child process - * `env` {Object} Environment key-value pairs - * `execPath` {string} Executable used to create the child process - * `execArgv` {Array} List of string arguments passed to the executable - (Default: `process.execArgv`) + * `cwd` {string} Current working directory of the child process. + * `env` {Object} Environment key-value pairs. + * `execPath` {string} Executable used to create the child process. + * `execArgv` {Array} List of string arguments passed to the executable. + **Default:** `process.execArgv` * `silent` {boolean} If `true`, stdin, stdout, and stderr of the child will be piped to the parent, otherwise they will be inherited from the parent, see the `'pipe'` and `'inherit'` options for [`child_process.spawn()`][]'s - [`stdio`][] for more details (Default: `false`) + [`stdio`][] for more details. **Default:** `false` * `stdio` {Array} Supports the array version of [`child_process.spawn()`][]'s [`stdio`][] option. When this option is provided, it overrides `silent`. The array must contain exactly one item with value `'ipc'` or an error will be thrown. For instance `[0, 1, 2, 'ipc']`. - * `uid` {number} Sets the user identity of the process. (See setuid(2).) - * `gid` {number} Sets the group identity of the process. (See setgid(2).) + * `uid` {number} Sets the user identity of the process (see setuid(2)). + * `gid` {number} Sets the group identity of the process (see setgid(2)). * Returns: {ChildProcess} The `child_process.fork()` method is a special case of @@ -308,24 +308,24 @@ not clone the current process.* added: v0.1.90 --> -* `command` {string} The command to run -* `args` {Array} List of string arguments +* `command` {string} The command to run. +* `args` {Array} List of string arguments. * `options` {Object} - * `cwd` {string} Current working directory of the child process - * `env` {Object} Environment key-value pairs + * `cwd` {string} Current working directory of the child process. + * `env` {Object} Environment key-value pairs. * `argv0` {string} Explicitly set the value of `argv[0]` sent to the child process. This will be set to `command` if not specified. - * `stdio` {Array|string} Child's stdio configuration. (See - [`options.stdio`][`stdio`]) + * `stdio` {Array|string} Child's stdio configuration (see + [`options.stdio`][`stdio`]). * `detached` {boolean} Prepare child to run independently of its parent process. Specific behavior depends on the platform, see - [`options.detached`][]) - * `uid` {number} Sets the user identity of the process. (See setuid(2).) - * `gid` {number} Sets the group identity of the process. (See setgid(2).) + [`options.detached`][]). + * `uid` {number} Sets the user identity of the process (see setuid(2)). + * `gid` {number} Sets the group identity of the process (see setgid(2)). * `shell` {boolean|string} If `true`, runs `command` inside of a shell. Uses `'/bin/sh'` on UNIX, and `'cmd.exe'` on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX, - or `/s /c` on Windows. Defaults to `false` (no shell). + or `/s /c` on Windows. **Default:** `false` (no shell). * Returns: {ChildProcess} The `child_process.spawn()` method spawns a new process using the given @@ -582,27 +582,27 @@ configuration at startup. added: v0.11.12 --> -* `file` {string} The name or path of the executable file to run -* `args` {Array} List of string arguments +* `file` {string} The name or path of the executable file to run. +* `args` {string[]} List of string arguments. * `options` {Object} - * `cwd` {string} Current working directory of the child process + * `cwd` {string} Current working directory of the child process. * `input` {string|Buffer} The value which will be passed as stdin to the - spawned process + spawned process. - supplying this value will override `stdio[0]` - * `stdio` {string|Array} Child's stdio configuration. (Default: `'pipe'`) + * `stdio` {string|Array} Child's stdio configuration. **Default:** `'pipe'` - `stderr` by default will be output to the parent process' stderr unless `stdio` is specified - * `env` {Object} Environment key-value pairs - * `uid` {number} Sets the user identity of the process. (See setuid(2).) - * `gid` {number} Sets the group identity of the process. (See setgid(2).) + * `env` {Object} Environment key-value pairs. + * `uid` {number} Sets the user identity of the process (see setuid(2)). + * `gid` {number} Sets the group identity of the process (see setgid(2)). * `timeout` {number} In milliseconds the maximum amount of time the process - is allowed to run. (Default: `undefined`) + is allowed to run. **Default:** `undefined` * `killSignal` {string|integer} The signal value to be used when the spawned - process will be killed. (Default: `'SIGTERM'`) - * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on - stdout or stderr - if exceeded child process is killed - * `encoding` {string} The encoding used for all stdio inputs and outputs. (Default: `'buffer'`) -* Returns: {Buffer|string} The stdout from the command + process will be killed. **Default:** `'SIGTERM'` + * [`maxBuffer`][] {number} Largest amount of data (in bytes) allowed on + stdout or stderr - if exceeded child process is killed. + * `encoding` {string} The encoding used for all stdio inputs and outputs. **Default:** `'buffer'` +* Returns: {Buffer|string} The stdout from the command. The `child_process.execFileSync()` method is generally identical to [`child_process.execFile()`][] with the exception that the method will not return @@ -621,31 +621,31 @@ throw an [`Error`][] that will include the full result of the underlying added: v0.11.12 --> -* `command` {string} The command to run +* `command` {string} The command to run. * `options` {Object} - * `cwd` {string} Current working directory of the child process + * `cwd` {string} Current working directory of the child process. * `input` {string|Buffer} The value which will be passed as stdin to the - spawned process + spawned process. - supplying this value will override `stdio[0]` - * `stdio` {string|Array} Child's stdio configuration. (Default: `'pipe'`) + * `stdio` {string|Array} Child's stdio configuration. **Default:** `'pipe'` - `stderr` by default will be output to the parent process' stderr unless `stdio` is specified - * `env` {Object} Environment key-value pairs - * `shell` {string} Shell to execute the command with - (Default: `'/bin/sh'` on UNIX, `'cmd.exe'` on Windows, The shell should + * `env` {Object} Environment key-value pairs. + * `shell` {string} Shell to execute the command with. + **Default:** `'/bin/sh'` on UNIX, `'cmd.exe'` on Windows. The shell should understand the `-c` switch on UNIX or `/s /c` on Windows. On Windows, - command line parsing should be compatible with `cmd.exe`.) - * `uid` {number} Sets the user identity of the process. (See setuid(2).) - * `gid` {number} Sets the group identity of the process. (See setgid(2).) + command line parsing should be compatible with `cmd.exe`. + * `uid` {number} Sets the user identity of the process. (see setuid(2)). + * `gid` {number} Sets the group identity of the process. (see setgid(2)). * `timeout` {number} In milliseconds the maximum amount of time the process - is allowed to run. (Default: `undefined`) + is allowed to run. **Default:** `undefined` * `killSignal` {string|integer} The signal value to be used when the spawned - process will be killed. (Default: `'SIGTERM'`) - * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on - stdout or stderr - if exceeded child process is killed + process will be killed. **Default:** `'SIGTERM'` + * [`maxBuffer`][] {number} Largest amount of data (in bytes) allowed on + stdout or stderr - if exceeded child process is killed. * `encoding` {string} The encoding used for all stdio inputs and outputs. - (Default: `'buffer'`) -* Returns: {Buffer|string} The stdout from the command + **Default:** `'buffer'` +* Returns: {Buffer|string} The stdout from the command. The `child_process.execSync()` method is generally identical to [`child_process.exec()`][] with the exception that the method will not return until @@ -668,37 +668,37 @@ execution.** added: v0.11.12 --> -* `command` {string} The command to run -* `args` {Array} List of string arguments +* `command` {string} The command to run. +* `args` {Array} List of string arguments. * `options` {Object} - * `cwd` {string} Current working directory of the child process + * `cwd` {string} Current working directory of the child process. * `input` {string|Buffer} The value which will be passed as stdin to the spawned process - - supplying this value will override `stdio[0]` + - supplying this value will override `stdio[0]`. * `stdio` {string|Array} Child's stdio configuration. - * `env` {Object} Environment key-value pairs - * `uid` {number} Sets the user identity of the process. (See setuid(2).) - * `gid` {number} Sets the group identity of the process. (See setgid(2).) + * `env` {Object} Environment key-value pairs. + * `uid` {number} Sets the user identity of the process (see setuid(2)). + * `gid` {number} Sets the group identity of the process (see setgid(2)). * `timeout` {number} In milliseconds the maximum amount of time the process - is allowed to run. (Default: `undefined`) + is allowed to run. **Default:** `undefined` * `killSignal` {string|integer} The signal value to be used when the spawned - process will be killed. (Default: `'SIGTERM'`) - * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on - stdout or stderr - if exceeded child process is killed + process will be killed. **Default:** `'SIGTERM'` + * [`maxBuffer`][] {number} Largest amount of data (in bytes) allowed on + stdout or stderr - if exceeded child process is killed. * `encoding` {string} The encoding used for all stdio inputs and outputs. - (Default: `'buffer'`) + **Default:** `'buffer'` * `shell` {boolean|string} If `true`, runs `command` inside of a shell. Uses `'/bin/sh'` on UNIX, and `'cmd.exe'` on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX, - or `/s /c` on Windows. Defaults to `false` (no shell). + or `/s /c` on Windows. **Default:** to `false` (no shell). * Returns: {Object} - * `pid` {number} Pid of the child process - * `output` {Array} Array of results from stdio output - * `stdout` {Buffer|string} The contents of `output[1]` - * `stderr` {Buffer|string} The contents of `output[2]` - * `status` {number} The exit code of the child process - * `signal` {string} The signal used to kill the child process - * `error` {Error} The error object if the child process failed or timed out + * `pid` {number} Pid of the child process. + * `output` {Array} Array of results from stdio output. + * `stdout` {Buffer|string} The contents of `output[1]`. + * `stderr` {Buffer|string} The contents of `output[2]`. + * `status` {number} The exit code of the child process. + * `signal` {string} The signal used to kill the child process. + * `error` {Error} The error object if the child process failed or timed out. The `child_process.spawnSync()` method is generally identical to [`child_process.spawn()`][] with the exception that the function will not return @@ -730,8 +730,8 @@ instances of `ChildProcess`. added: v0.7.7 --> -* `code` {number} the exit code if the child exited on its own. -* `signal` {string} the signal by which the child process was terminated. +* `code` {number} The exit code if the child exited on its own. +* `signal` {string} The signal by which the child process was terminated. The `'close'` event is emitted when the stdio streams of a child process have been closed. This is distinct from the [`'exit'`][] event, since multiple @@ -750,7 +750,7 @@ property is `false`. ### Event: 'error' -* `err` {Error} the error. +* `err` {Error} The error. The `'error'` event is emitted whenever: @@ -769,8 +769,8 @@ See also [`subprocess.kill()`][] and [`subprocess.send()`][]. added: v0.1.90 --> -* `code` {number} the exit code if the child exited on its own. -* `signal` {string} the signal by which the child process was terminated. +* `code` {number} The exit code if the child exited on its own. +* `signal` {string} The signal by which the child process was terminated. The `'exit'` event is emitted after the child process ends. If the process exited, `code` is the final exit code of the process, otherwise `null`. If the @@ -792,8 +792,8 @@ See waitpid(2). added: v0.5.9 --> -* `message` {Object} a parsed JSON object or primitive value. -* `sendHandle` {Handle} a [`net.Socket`][] or [`net.Server`][] object, or +* `message` {Object} A parsed JSON object or primitive value. +* `sendHandle` {Handle} A [`net.Socket`][] or [`net.Server`][] object, or undefined. The `'message'` event is triggered when a child process uses [`process.send()`][] @@ -805,7 +805,7 @@ to send messages. added: v0.7.2 --> -* {boolean} Set to `false` after `subprocess.disconnect()` is called +* {boolean} Set to `false` after `subprocess.disconnect()` is called. The `subprocess.connected` property indicates whether it is still possible to send and receive messages from a child process. When `subprocess.connected` is diff --git a/doc/api/cluster.md b/doc/api/cluster.md index c73289d7314b7d..6edd92c263989b 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -150,8 +150,8 @@ In a worker you can also use `process.on('error')`. added: v0.11.2 --> -* `code` {number} the exit code, if it exited normally. -* `signal` {string} the name of the signal (e.g. `'SIGHUP'`) that caused +* `code` {number} The exit code, if it exited normally. +* `signal` {string} The name of the signal (e.g. `'SIGHUP'`) that caused the process to be killed. Similar to the `cluster.on('exit')` event, but specific to this worker. @@ -423,7 +423,7 @@ added: v0.7.0 * `message` {Object} * `sendHandle` {Handle} * `callback` {Function} -* Returns: Boolean +* Returns: {boolean} Send a message to a worker or master, optionally with a handle. @@ -504,8 +504,8 @@ added: v0.7.9 --> * `worker` {cluster.Worker} -* `code` {number} the exit code, if it exited normally. -* `signal` {string} the name of the signal (e.g. `'SIGHUP'`) that caused +* `code` {number} The exit code, if it exited normally. +* `signal` {string} The name of the signal (e.g. `'SIGHUP'`) that caused the process to be killed. When any of the workers die the cluster module will emit the `'exit'` event. @@ -648,8 +648,8 @@ If accuracy is important, use `cluster.settings`. added: v0.7.7 --> -* `callback` {Function} called when all workers are disconnected and handles are - closed +* `callback` {Function} Called when all workers are disconnected and handles are + closed. Calls `.disconnect()` on each worker in `cluster.workers`. @@ -666,7 +666,7 @@ added: v0.6.0 --> * `env` {Object} Key/value pairs to add to worker process environment. -* return {cluster.Worker} +* Returns: {cluster.Worker} Spawn a new worker process. @@ -717,17 +717,17 @@ added: v0.7.1 * {Object} * `execArgv` {Array} list of string arguments passed to the Node.js - executable. (Default=`process.execArgv`) - * `exec` {string} file path to worker file. (Default=`process.argv[1]`) + executable. **Default:** `process.execArgv` + * `exec` {string} file path to worker file. **Default:** `process.argv[1]` * `args` {Array} string arguments passed to worker. - (Default=`process.argv.slice(2)`) + **Default:**: `process.argv.slice(2)` * `silent` {boolean} whether or not to send output to parent's stdio. - (Default=`false`) + **Default:** `false` * `stdio` {Array} Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must contain an `'ipc'` entry. When this option is provided, it overrides `silent`. - * `uid` {number} Sets the user identity of the process. (See setuid(2).) - * `gid` {number} Sets the group identity of the process. (See setgid(2).) + * `uid` {number} Sets the user identity of the process. (see setuid(2)) + * `gid` {number} Sets the group identity of the process. (see setgid(2)) After calling `.setupMaster()` (or `.fork()`) this settings object will contain the settings, including the default values. @@ -740,11 +740,11 @@ added: v0.7.1 --> * `settings` {Object} - * `exec` {string} file path to worker file. (Default=`process.argv[1]`) + * `exec` {string} file path to worker file. **Default:** `process.argv[1]` * `args` {Array} string arguments passed to worker. - (Default=`process.argv.slice(2)`) + **Default:**: `process.argv.slice(2)` * `silent` {boolean} whether or not to send output to parent's stdio. - (Default=`false`) + **Default:** `false` * `stdio` {Array} Configures the stdio of forked processes. When this option is provided, it overrides `silent`. diff --git a/doc/api/dgram.md b/doc/api/dgram.md index 73e86baa0e175d..22615d878f1fab 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -74,12 +74,12 @@ added: v0.1.99 The `'message'` event is emitted when a new datagram is available on a socket. The event handler function is passed two arguments: `msg` and `rinfo`. -* `msg` {Buffer} - The message -* `rinfo` {Object} - Remote address information - * `address` {string} The sender address - * `family` {string} The address family (`'IPv4'` or `'IPv6'`) - * `port` {number} The sender port - * `size` {number} The message size +* `msg` {Buffer} The message. +* `rinfo` {Object} Remote address information. + * `address` {string} The sender address. + * `family` {string} The address family (`'IPv4'` or `'IPv6'`). + * `port` {number} The sender port. + * `size` {number} The message size. ### socket.addMembership(multicastAddress[, multicastInterface]) * `multicastAddress` {string} -* `multicastInterface` {string}, Optional +* `multicastInterface` {string} Tells the kernel to join a multicast group at the given `multicastAddress` and `multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the @@ -109,10 +109,9 @@ properties. added: v0.1.99 --> -* `port` {number} - Integer, Optional -* `address` {string}, Optional -* `callback` {Function} with no parameters, Optional. Called when - binding is complete. +* `port` {number} Integer. +* `address` {string} +* `callback` {Function} with no parameters. Called when binding is complete. For UDP sockets, causes the `dgram.Socket` to listen for datagram messages on a named `port` and optional `address`. If `port` is not @@ -161,11 +160,11 @@ server.bind(41234); added: v0.11.14 --> -* `options` {Object} - Required. Supports the following properties: - * `port` {number} - Optional. - * `address` {string} - Optional. - * `exclusive` {boolean} - Optional. -* `callback` {Function} - Optional. +* `options` {Object} Required. Supports the following properties: + * `port` {Integer} + * `address` {string} + * `exclusive` {boolean} +* `callback` {Function} For UDP sockets, causes the `dgram.Socket` to listen for datagram messages on a named `port` and optional `address` that are passed as @@ -217,7 +216,7 @@ added: v0.6.9 --> * `multicastAddress` {string} -* `multicastInterface` {string}, Optional +* `multicastInterface` {string} Instructs the kernel to leave a multicast group at `multicastAddress` using the `IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the @@ -232,12 +231,12 @@ drop membership on all valid interfaces. added: v0.1.99 --> -* `msg` {Buffer|string|array} Message to be sent -* `offset` {number} Integer. Optional. Offset in the buffer where the message starts. -* `length` {number} Integer. Optional. Number of bytes in the message. +* `msg` {Buffer|string|array} Message to be sent. +* `offset` {number} Integer. Offset in the buffer where the message starts. +* `length` {number} Integer. Number of bytes in the message. * `port` {number} Integer. Destination port. * `address` {string} Destination hostname or IP address. -* `callback` {Function} Called when the message has been sent. Optional. +* `callback` {Function} Called when the message has been sent. Broadcasts a datagram on the socket. The destination `port` and `address` must be specified. @@ -352,7 +351,7 @@ multicast packets will also be received on the local interface. added: v0.3.8 --> -* `ttl` {number} Integer +* `ttl` {number} Integer. Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for "Time to Live", in this context it specifies the number of IP hops that a @@ -368,7 +367,7 @@ between 0 and 255. The default on most systems is `1` but can vary. added: v0.1.101 --> -* `ttl` {number} Integer +* `ttl` {number} Integer. Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live", in this context it specifies the number of IP hops that a packet is allowed to @@ -465,9 +464,8 @@ and `udp6` sockets). The bound address and port can be retrieved using added: v0.1.99 --> -* `type` {string} - Either 'udp4' or 'udp6' +* `type` {string} - Either 'udp4' or 'udp6'. * `callback` {Function} - Attached as a listener to `'message'` events. - Optional * Returns: {dgram.Socket} Creates a `dgram.Socket` object of the specified `type`. The `type` argument diff --git a/doc/api/stream.md b/doc/api/stream.md index 21194fc10a0090..353cf1b3c15f7c 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1504,7 +1504,7 @@ user programs. * `chunk` {Buffer|null|string} Chunk of data to push into the read queue * `encoding` {string} Encoding of String chunks. Must be a valid Buffer encoding, such as `'utf8'` or `'ascii'` -* Returns {boolean} `true` if additional chunks of data may continued to be +* Returns: {boolean} `true` if additional chunks of data may continued to be pushed; `false` otherwise. When `chunk` is a `Buffer` or `string`, the `chunk` of data will be added to the