diff --git a/doc/STYLE_GUIDE.md b/doc/STYLE_GUIDE.md index 009b0ee2b5ec4b..7b9ee659a15b78 100644 --- a/doc/STYLE_GUIDE.md +++ b/doc/STYLE_GUIDE.md @@ -59,9 +59,9 @@ * Use a capital letter after the "Note:" label. * Preferably, make the note a new paragraph for better visual distinction. * 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][] + * * \`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`. diff --git a/doc/api/assert.md b/doc/api/assert.md index b7976c2cf4cf9a..f39305d341e8ba 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -430,7 +430,7 @@ added: v0.1.21 * `actual` {any} * `expected` {any} * `message` {any} **Default:** `'Failed'` -* `operator` {string} **Default:** '!=' +* `operator` {string} **Default:** `'!='` * `stackStartFunction` {Function} **Default:** `assert.fail` Throws an `AssertionError`. If `message` is falsy, the error message is set as diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 4287aa78ced8e0..9501daa9919435 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -206,7 +206,7 @@ instance is destroyed. * `type` {string} The type of the async resource. * `triggerAsyncId` {number} The unique ID of the async resource in whose execution context this async resource was created. -* `resource` {Object} Reference to the resource representing the async +* `resource` {Object} Reference to the resource representing the async operation, needs to be released during _destroy_. Called when a class is constructed that has the _possibility_ to emit an @@ -283,10 +283,10 @@ The `TCPSERVERWRAP` is the server which receives the connections. The `TCPWRAP` is the new connection from the client. When a new connection is made the `TCPWrap` instance is immediately constructed. This -happens outside of any JavaScript stack (side note: a `executionAsyncId()` of +happens outside of any JavaScript stack (side note: a `executionAsyncId()` of `0` means it's being executed from C++, with no JavaScript stack above it). With only that information, it would be impossible to link resources together in -terms of what caused them to be created, so `triggerAsyncId` is given the task +terms of what caused them to be created, so `triggerAsyncId` is given the task of propagating what resource is responsible for the new resource's existence. ###### `resource` @@ -582,7 +582,7 @@ the details of the V8 [PromiseHooks][] API. ## JavaScript Embedder API Library developers that handle their own asynchronous resources performing tasks -like I/O, connection pooling, or managing callback queues may use the +like I/O, connection pooling, or managing callback queues may use the `AsyncWrap` JavaScript API so that all the appropriate callbacks are called. ### `class AsyncResource()` @@ -640,8 +640,7 @@ asyncResource.emitAfter(); * `requireManualDestroy` {boolean} Disables automatic `emitDestroy` when the object is garbage collected. This usually does not need to be set (even if `emitDestroy` is called manually), unless the resource's asyncId is retrieved - and the sensitive API's `emitDestroy` is called with it. - **Default:** `false` + and the sensitive API's `emitDestroy` is called with it. **Default:** `false`. Example usage: @@ -728,7 +727,7 @@ never be called. #### `asyncResource.triggerAsyncId()` -* Returns: {number} The same `triggerAsyncId` that is passed to the +* Returns: {number} The same `triggerAsyncId` that is passed to the `AsyncResource` constructor. [`after` callback]: #async_hooks_after_asyncid diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 2b63b4eb2e13f2..970d3163e40965 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -345,9 +345,9 @@ changes: * `arrayBuffer` {ArrayBuffer|SharedArrayBuffer} An [`ArrayBuffer`], [`SharedArrayBuffer`] or the `.buffer` property of a [`TypedArray`]. -* `byteOffset` {integer} Index of first byte to expose. **Default:** `0` +* `byteOffset` {integer} Index of first byte to expose. **Default:** `0`. * `length` {integer} Number of bytes to expose. - **Default:** `arrayBuffer.length - byteOffset` + **Default:** `arrayBuffer.length - byteOffset`. This creates a view of the [`ArrayBuffer`] or [`SharedArrayBuffer`] without copying the underlying memory. For example, when passed a reference to the @@ -459,7 +459,7 @@ changes: > Use [`Buffer.from(string[, encoding])`][`Buffer.from(string)`] instead. * `string` {string} String to encode. -* `encoding` {string} The encoding of `string`. **Default:** `'utf8'` +* `encoding` {string} The encoding of `string`. **Default:** `'utf8'`. Creates a new `Buffer` containing `string`. The `encoding` parameter identifies the character encoding of `string`. @@ -488,9 +488,9 @@ changes: * `size` {integer} The desired length of the new `Buffer`. * `fill` {string|Buffer|integer} A value to pre-fill the new `Buffer` with. - **Default:** `0` + **Default:** `0`. * `encoding` {string} If `fill` is a string, this is its encoding. - **Default:** `'utf8'` + **Default:** `'utf8'`. Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the `Buffer` will be *zero-filled*. @@ -646,7 +646,7 @@ changes: * `string` {string|Buffer|TypedArray|DataView|ArrayBuffer|SharedArrayBuffer} A value to calculate the length of. * `encoding` {string} If `string` is a string, this is its encoding. - **Default:** `'utf8'` + **Default:** `'utf8'`. * Returns: {integer} The number of bytes contained within `string`. Returns the actual byte length of a string. This is not the same as @@ -766,9 +766,9 @@ added: v5.10.0 * `arrayBuffer` {ArrayBuffer|SharedArrayBuffer} An [`ArrayBuffer`], [`SharedArrayBuffer`], or the `.buffer` property of a [`TypedArray`]. -* `byteOffset` {integer} Index of first byte to expose. **Default:** `0` +* `byteOffset` {integer} Index of first byte to expose. **Default:** `0`. * `length` {integer} Number of bytes to expose. - **Default:** `arrayBuffer.length - byteOffset` + **Default:** `arrayBuffer.length - byteOffset`. This creates a view of the [`ArrayBuffer`] without copying the underlying memory. For example, when passed a reference to the `.buffer` property of a @@ -837,7 +837,7 @@ added: v5.10.0 --> * `string` {string} A string to encode. -* `encoding` {string} The encoding of `string`. **Default:** `'utf8'` +* `encoding` {string} The encoding of `string`. **Default:** `'utf8'`. Creates a new `Buffer` containing `string`. The `encoding` parameter identifies the character encoding of `string`. @@ -976,13 +976,13 @@ changes: * `target` {Buffer|Uint8Array} A `Buffer` or [`Uint8Array`] to compare to. * `targetStart` {integer} The offset within `target` at which to begin - comparison. **Default:** `0` + comparison. **Default:** `0`. * `targetEnd` {integer} The offset with `target` at which to end comparison - (not inclusive). **Default:** `target.length` + (not inclusive). **Default:** `target.length`. * `sourceStart` {integer} The offset within `buf` at which to begin comparison. - **Default:** `0` + **Default:** `0`. * `sourceEnd` {integer} The offset within `buf` at which to end comparison - (not inclusive). **Default:** [`buf.length`] + (not inclusive). **Default:** [`buf.length`]. * Returns: {integer} Compares `buf` with `target` and returns a number indicating whether `buf` @@ -1039,11 +1039,11 @@ added: v0.1.90 * `target` {Buffer|Uint8Array} A `Buffer` or [`Uint8Array`] to copy into. * `targetStart` {integer} The offset within `target` at which to begin - copying to. **Default:** `0` + copying to. **Default:** `0`. * `sourceStart` {integer} The offset within `buf` at which to begin copying from. - **Default:** `0` + **Default:** `0`. * `sourceEnd` {integer} The offset within `buf` at which to stop copying (not - inclusive). **Default:** [`buf.length`] + inclusive). **Default:** [`buf.length`]. * Returns: {integer} The number of bytes copied. Copies data from a region of `buf` to a region in `target` even if the `target` @@ -1146,10 +1146,10 @@ changes: --> * `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`] +* `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'` + **Default:** `'utf8'`. * Returns: {Buffer} A reference to `buf`. Fills `buf` with the specified `value`. If the `offset` and `end` are not given, @@ -1197,9 +1197,9 @@ added: v5.3.0 --> * `value` {string|Buffer|integer} What to search for. -* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0` +* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0`. * `encoding` {string} If `value` is a string, this is its encoding. - **Default:** `'utf8'` + **Default:** `'utf8'`. * Returns: {boolean} `true` if `value` was found in `buf`, `false` otherwise. Equivalent to [`buf.indexOf() !== -1`][`buf.indexOf()`]. @@ -1237,9 +1237,9 @@ changes: --> * `value` {string|Buffer|Uint8Array|integer} What to search for. -* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0` +* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0`. * `encoding` {string} If `value` is a string, this is its encoding. - **Default:** `'utf8'` + **Default:** `'utf8'`. * Returns: {integer} The index of the first occurrence of `value` in `buf` or `-1` if `buf` does not contain `value`. @@ -1339,9 +1339,9 @@ changes: * `value` {string|Buffer|Uint8Array|integer} What to search for. * `byteOffset` {integer} Where to begin searching in `buf`. - **Default:** [`buf.length`]` - 1` + **Default:** [`buf.length`]` - 1`. * `encoding` {string} If `value` is a string, this is its encoding. - **Default:** `'utf8'` + **Default:** `'utf8'`. * Returns: {integer} The index of the last occurrence of `value` in `buf` or `-1` if `buf` does not contain `value`. @@ -1761,9 +1761,9 @@ changes: calculations with them. --> -* `start` {integer} Where the new `Buffer` will start. **Default:** `0` +* `start` {integer} Where the new `Buffer` will start. **Default:** `0`. * `end` {integer} Where the new `Buffer` will end (not inclusive). - **Default:** [`buf.length`] + **Default:** [`buf.length`]. * Returns: {Buffer} Returns a new `Buffer` that references the same memory as the original, but @@ -1932,10 +1932,10 @@ console.log(copy); added: v0.1.90 --> -* `encoding` {string} The character encoding to decode to. **Default:** `'utf8'` -* `start` {integer} The byte offset to start decoding at. **Default:** `0` +* `encoding` {string} The character encoding to decode to. **Default:** `'utf8'`. +* `start` {integer} The byte offset to start decoding at. **Default:** `0`. * `end` {integer} The byte offset to stop decoding at (not inclusive). - **Default:** [`buf.length`] + **Default:** [`buf.length`]. * Returns: {string} Decodes `buf` to a string according to the specified character encoding in @@ -2009,9 +2009,9 @@ added: v0.1.90 --> * `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'` +* `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. Writes `string` to `buf` at `offset` according to the character encoding in `encoding`. @@ -2326,7 +2326,7 @@ added: v0.5.5 * `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` + **Default:** `false`. * Returns: {integer} `offset` plus the number of bytes written. Writes `byteLength` bytes of `value` to `buf` at the specified `offset`. diff --git a/doc/api/child_process.md b/doc/api/child_process.md index b85961a794c579..4f1f236de6c520 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -139,11 +139,12 @@ changes: * `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. + **Default:** `null`. + * `env` {Object} Environment key-value pairs. **Default:** `null`. * `encoding` {string} **Default:** `'utf8'` - * `shell` {string} Shell to execute the command with. - **Default:** `'/bin/sh'` on UNIX, `process.env.ComSpec` on Windows. See - [Shell Requirements][] and [Default Windows Shell][]. + * `shell` {string} Shell to execute the command with. See + [Shell Requirements][] and [Default Windows Shell][]. **Default:** + `'/bin/sh'` on UNIX, `process.env.ComSpec` on Windows. * `timeout` {number} **Default:** `0` * `maxBuffer` {number} Largest amount of data in bytes allowed on stdout or stderr. If exceeded, the child process is terminated. See caveat at @@ -202,20 +203,6 @@ can be used to specify the character encoding used to decode the stdout and stderr output. If `encoding` is `'buffer'`, or an unrecognized character encoding, `Buffer` objects will be passed to the callback instead. -The `options` argument may be passed as the second argument to customize how -the process is spawned. The default options are: - -```js -const defaults = { - encoding: 'utf8', - timeout: 0, - maxBuffer: 200 * 1024, - killSignal: 'SIGTERM', - cwd: null, - env: null -}; -``` - If `timeout` is greater than `0`, the parent will send the signal identified by the `killSignal` property (the default is `'SIGTERM'`) if the child runs longer than `timeout` milliseconds. @@ -341,11 +328,11 @@ changes: * `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` + **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|string} See [`child_process.spawn()`][]'s [`stdio`][]. When this option is provided, it overrides `silent`. If the array variant is used, it must contain exactly one item with value `'ipc'` or an error @@ -699,18 +686,17 @@ changes: * `options` {Object} * `cwd` {string} Current working directory of the child process. * `input` {string|Buffer|Uint8Array} The value which will be passed as stdin - to the spawned process. - - supplying this value will override `stdio[0]` - * `stdio` {string|Array} Child's stdio configuration. **Default:** `'pipe'` - - `stderr` by default will be output to the parent process' stderr unless - `stdio` is specified + to the spawned process. Supplying this value will override `stdio[0]`. + * `stdio` {string|Array} Child's stdio configuration. `stderr` by default will + be output to the parent process' stderr unless `stdio` is specified. + **Default:** `'pipe'`. * `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'` + process will be killed. **Default:** `'SIGTERM'`. * `maxBuffer` {number} Largest amount of data in bytes allowed on stdout or stderr. If exceeded, the child process is terminated. See caveat at [`maxBuffer` and Unicode][]. **Default:** `200 * 1024`. @@ -758,26 +744,25 @@ changes: * `options` {Object} * `cwd` {string} Current working directory of the child process. * `input` {string|Buffer|Uint8Array} The value which will be passed as stdin - to the spawned process. - - supplying this value will override `stdio[0]`. - * `stdio` {string|Array} Child's stdio configuration. **Default:** `'pipe'` - - `stderr` by default will be output to the parent process' stderr unless - `stdio` is specified + to the spawned process. Supplying this value will override `stdio[0]`. + * `stdio` {string|Array} Child's stdio configuration. `stderr` by default will + be output to the parent process' stderr unless `stdio` is specified. + **Default:** `'pipe'`. * `env` {Object} Environment key-value pairs. - * `shell` {string} Shell to execute the command with. - **Default:** `'/bin/sh'` on UNIX, `process.env.ComSpec` on Windows. See - [Shell Requirements][] and [Default Windows Shell][]. + * `shell` {string} Shell to execute the command with. See + [Shell Requirements][] and [Default Windows Shell][]. **Default:** + `'/bin/sh'` on UNIX, `process.env.ComSpec` on Windows. * `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'` + process will be killed. **Default:** `'SIGTERM'`. * `maxBuffer` {number} Largest amount of data in bytes allowed on stdout or stderr. If exceeded, the child process is terminated. See caveat at [`maxBuffer` and Unicode][]. **Default:** `200 * 1024`. * `encoding` {string} The encoding used for all stdio inputs and outputs. - **Default:** `'buffer'` + **Default:** `'buffer'`. * `windowsHide` {boolean} Hide the subprocess console window that would normally be created on Windows systems. **Default:** `false`. * Returns: {Buffer|string} The stdout from the command. @@ -820,21 +805,20 @@ changes: * `options` {Object} * `cwd` {string} Current working directory of the child process. * `input` {string|Buffer|Uint8Array} The value which will be passed as stdin - to the spawned process. - - supplying this value will override `stdio[0]`. + to the spawned process. 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)). * `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'` + process will be killed. **Default:** `'SIGTERM'`. * `maxBuffer` {number} Largest amount of data in bytes allowed on stdout or stderr. If exceeded, the child process is terminated. See caveat at [`maxBuffer` and Unicode][]. **Default:** `200 * 1024`. * `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 `process.env.ComSpec` on Windows. A different shell can be specified as a string. See [Shell Requirements][] and @@ -1105,7 +1089,12 @@ changes: * `message` {Object} * `sendHandle` {Handle} -* `options` {Object} +* `options` {Object} The `options` argument, if present, is an object used to + parameterize the sending of certain types of handles. `options` supports + the following properties: + * `keepOpen` - A Boolean value that can be used when passing instances of + `net.Socket`. When `true`, the socket is kept open in the sending process. + **Default:** `false`. * `callback` {Function} * Returns: {boolean} @@ -1160,14 +1149,6 @@ receive the object as the second argument passed to the callback function registered on the [`process.on('message')`][] event. Any data that is received and buffered in the socket will not be sent to the child. -The `options` argument, if present, is an object used to parameterize the -sending of certain types of handles. `options` supports the following -properties: - - * `keepOpen` - A Boolean value that can be used when passing instances of - `net.Socket`. When `true`, the socket is kept open in the sending process. - Defaults to `false`. - The optional `callback` is a function that is invoked after the message is sent but before the child may have received it. The function is called with a single argument: `null` on success, or an [`Error`][] object on failure. diff --git a/doc/api/cluster.md b/doc/api/cluster.md index 0e33cfd412886b..c753136fe0f924 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -714,14 +714,14 @@ changes: * {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)`. * `cwd` {string} Current working directory of the worker process. **Default:** - `undefined` (inherits from parent process) + `undefined` (inherits from parent process). * `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`. @@ -732,7 +732,7 @@ changes: number. By default each worker gets its own port, incremented from the master's `process.debugPort`. * `windowsHide` {boolean} Hide the forked processes console window that would - normally be created on Windows systems. **Default:** `false` + normally be created on Windows systems. **Default:** `false`. After calling `.setupMaster()` (or `.fork()`) this settings object will contain the settings, including the default values. diff --git a/doc/api/console.md b/doc/api/console.md index df475b27086bbb..2f00db3c6465a6 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -187,7 +187,7 @@ binary. added: v8.3.0 --> -* `label` {string} The display label for the counter. Defaults to `'default'`. +* `label` {string} The display label for the counter. **Default:** `'default'`. Maintains an internal counter specific to `label` and outputs to `stdout` the number of times `console.count()` has been called with the given `label`. @@ -220,7 +220,7 @@ undefined added: v8.3.0 --> -* `label` {string} The display label for the counter. Defaults to `'default'`. +* `label` {string} The display label for the counter. **Default:** `'default'`. Resets the internal counter specific to `label`. @@ -256,25 +256,17 @@ added: v0.1.101 --> * `obj` {any} * `options` {Object} - * `showHidden` {boolean} - * `depth` {number} - * `colors` {boolean} + * `showHidden` {boolean} If `true` then the object's non-enumerable and symbol + properties will be shown too. **Default:** `false`. + * `depth` {number} Tells [`util.inspect()`][] how many times to recurse while + formatting the object. This is useful for inspecting large complicated + objects. To make it recurse indefinitely, pass `null`. **Default:** `2`. + * `colors` {boolean} If `true`, then the output will be styled with ANSI color + codes. Colors are customizable; + see [customizing `util.inspect()` colors][]. **Default:** `false`. Uses [`util.inspect()`][] on `obj` and prints the resulting string to `stdout`. -This function bypasses any custom `inspect()` function defined on `obj`. An -optional `options` object may be passed to alter certain aspects of the -formatted string: - -- `showHidden` - if `true` then the object's non-enumerable and symbol -properties will be shown too. Defaults to `false`. - -- `depth` - tells [`util.inspect()`][] how many times to recurse while -formatting the object. This is useful for inspecting large complicated objects. -Defaults to `2`. To make it recurse indefinitely, pass `null`. - -- `colors` - if `true`, then the output will be styled with ANSI color codes. -Defaults to `false`. Colors are customizable; see -[customizing `util.inspect()` colors][]. +This function bypasses any custom `inspect()` function defined on `obj`. ### console.dirxml(...data) -* `label` {string} Defaults to `'default'`. +* `label` {string} **Default:** `'default'` Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique `label`. Use the same `label` when calling @@ -390,7 +382,7 @@ changes: description: This method no longer supports multiple calls that don’t map to individual `console.time()` calls; see below for details. --> -* `label` {string} Defaults to `'default'`. +* `label` {string} **Default:** `'default'` Stops a timer that was previously started by calling [`console.time()`][] and prints the result to `stdout`: @@ -446,7 +438,7 @@ not display anything unless used in conjunction with the [inspector][] -* `label` {string} Defaults to `'default'`. +* `label` {string} **Default:** `'default'` This method does not display anything unless used in the inspector. The `console.markTimeline()` method is the deprecated form of @@ -503,7 +495,7 @@ This method does not display anything unless used in the inspector. The -* `label` {string} Defaults to `'default'`. +* `label` {string} **Default:** `'default'` This method does not display anything unless used in the inspector. The `console.timeline()` method is the deprecated form of [`console.time()`][]. @@ -512,7 +504,7 @@ This method does not display anything unless used in the inspector. The -* `label` {string} Defaults to `'default'`. +* `label` {string} **Default:** `'default'` This method does not display anything unless used in the inspector. The `console.timelineEnd()` method is the deprecated form of diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 74bfcaad788fd0..2cc07def918864 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -270,7 +270,7 @@ been completed using the [`cipher.final()`][] method. -- `autoPadding` {boolean} Defaults to `true`. +- `autoPadding` {boolean} **Default:** `true` - Returns the {Cipher} for method chaining. When using block encryption algorithms, the `Cipher` class will automatically @@ -443,7 +443,7 @@ The `decipher.setAuthTag()` method must be called before -- `autoPadding` {boolean} Defaults to `true`. +- `autoPadding` {boolean} **Default:** `true` - Returns the {Cipher} for method chaining. When data has been encrypted without standard block padding, calling @@ -684,7 +684,7 @@ If `outputEncoding` is given a string will be returned; otherwise a added: v0.11.14 --> - `encoding` {string} -- `format` {string} Defaults to `uncompressed`. +- `format` {string} **Default:** `uncompressed` Generates private and public EC Diffie-Hellman key values, and returns the public key in the specified `format` and `encoding`. This key should be @@ -713,7 +713,7 @@ a string is returned; otherwise a [`Buffer`][] is returned. added: v0.11.14 --> - `encoding` {string} -- `format` {string} Defaults to `uncompressed`. +- `format` {string} **Default:** `uncompressed` Returns the EC Diffie-Hellman public key in the specified `encoding` and `format`. @@ -1232,7 +1232,7 @@ become deprecated in a future Node.js release. added: v6.0.0 --> -Property for checking and controlling whether a FIPS compliant crypto provider +Property for checking and controlling whether a FIPS compliant crypto provider is currently in use. Setting to true requires a FIPS build of Node.js. ### crypto.createCipher(algorithm, password[, options]) @@ -1285,7 +1285,7 @@ changes: - `options` {Object} [`stream.transform` options][] Creates and returns a `Cipher` object, with the given `algorithm`, `key` and -initialization vector (`iv`). Optional `options` argument controls stream +initialization vector (`iv`). Optional `options` argument controls stream behavior. The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On @@ -1382,8 +1382,8 @@ changes: --> - `prime` {string | Buffer | TypedArray | DataView} - `primeEncoding` {string} -- `generator` {number | string | Buffer | TypedArray | DataView} Defaults to - `2`. +- `generator` {number | string | Buffer | TypedArray | DataView} **Default:** + `2` - `generatorEncoding` {string} Creates a `DiffieHellman` key exchange object using the supplied `prime` and an @@ -1406,8 +1406,8 @@ otherwise a number, [`Buffer`][], `TypedArray`, or `DataView` is expected. added: v0.5.0 --> - `primeLength` {number} -- `generator` {number | string | Buffer | TypedArray | DataView} Defaults to - `2`. +- `generator` {number | string | Buffer | TypedArray | DataView} **Default:** + `2` Creates a `DiffieHellman` key exchange object and generates a prime of `primeLength` bits using an optional specific numeric `generator`. @@ -1875,8 +1875,8 @@ changes: --> * `buffer` {Buffer|TypedArray|DataView} Must be supplied. -* `offset` {number} Defaults to `0`. -* `size` {number} Defaults to `buffer.length - offset`. +* `offset` {number} **Default:** `0` +* `size` {number} **Default:** `buffer.length - offset` Synchronous version of [`crypto.randomFill()`][]. @@ -1917,8 +1917,8 @@ changes: --> * `buffer` {Buffer|TypedArray|DataView} Must be supplied. -* `offset` {number} Defaults to `0`. -* `size` {number} Defaults to `buffer.length - offset`. +* `offset` {number} **Default:** `0` +* `size` {number} **Default:** `buffer.length - offset` * `callback` {Function} `function(err, buf) {}`. This function is similar to [`crypto.randomBytes()`][] but requires the first @@ -1982,7 +1982,7 @@ request. added: v0.11.11 --> - `engine` {string} -- `flags` {crypto.constants} Defaults to `crypto.constants.ENGINE_METHOD_ALL`. +- `flags` {crypto.constants} **Default:** `crypto.constants.ENGINE_METHOD_ALL` Load and set the `engine` for some or all OpenSSL functions (selected by flags). diff --git a/doc/api/dgram.md b/doc/api/dgram.md index 7e5db83e88c6a5..b30a489ed2fae7 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -583,10 +583,10 @@ changes: Required. * `reuseAddr` {boolean} When `true` [`socket.bind()`][] will reuse the address, even if another process has already bound a socket on it. - Defaults to `false`. + **Default:** `false`. * `recvBufferSize` {number} - Sets the `SO_RCVBUF` socket value. * `sendBufferSize` {number} - Sets the `SO_SNDBUF` socket value. - * `lookup` {Function} Custom lookup function. Defaults to [`dns.lookup()`][]. + * `lookup` {Function} Custom lookup function. **Default:** [`dns.lookup()`][]. * `callback` {Function} Attached as a listener for `'message'` events. Optional. * Returns: {dgram.Socket} diff --git a/doc/api/dns.md b/doc/api/dns.md index 8bc266611cee96..5fd6b28e05a20a 100644 --- a/doc/api/dns.md +++ b/doc/api/dns.md @@ -139,7 +139,7 @@ changes: - `hints` {number} One or more [supported `getaddrinfo` flags][]. Multiple flags may be passed by bitwise `OR`ing their values. - `all` {boolean} When `true`, the callback returns all resolved addresses in - an array. Otherwise, returns a single address. **Default:** `false` + an array. Otherwise, returns a single address. **Default:** `false`. - `verbatim` {boolean} When `true`, the callback receives IPv4 and IPv6 addresses in the order the DNS resolver returned them. When `false`, IPv4 addresses are placed before IPv6 addresses. @@ -243,7 +243,7 @@ Promise for an object with `hostname` and `service` properties. added: v0.1.27 --> - `hostname` {string} Hostname to resolve. -- `rrtype` {string} Resource record type. **Default:** `'A'` +- `rrtype` {string} Resource record type. **Default:** `'A'`. - `callback` {Function} - `err` {Error} - `records` {string[] | Object[] | Object} diff --git a/doc/api/fs.md b/doc/api/fs.md index 79ac32fe022071..8f2a75d54964a4 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1149,7 +1149,7 @@ added: v8.5.0 * `src` {string|Buffer|URL} source filename to copy * `dest` {string|Buffer|URL} destination filename of the copy operation -* `flags` {number} modifiers for copy operation. **Default:** `0` +* `flags` {number} modifiers for copy operation. **Default:** `0`. * `callback` {Function} Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it @@ -1192,7 +1192,7 @@ added: v8.5.0 * `src` {string|Buffer|URL} source filename to copy * `dest` {string|Buffer|URL} destination filename of the copy operation -* `flags` {number} modifiers for copy operation. **Default:** `0` +* `flags` {number} modifiers for copy operation. **Default:** `0`. Synchronously copies `src` to `dest`. By default, `dest` is overwritten if it already exists. Returns `undefined`. Node.js makes no guarantees about the @@ -1900,7 +1900,7 @@ changes: * `err` {Error} Asynchronously creates a directory. No arguments other than a possible exception -are given to the completion callback. `mode` defaults to `0o777`. +are given to the completion callback. See also: mkdir(2) @@ -2025,7 +2025,7 @@ changes: * `path` {string|Buffer|URL} * `flags` {string|number} -* `mode` {integer} **Default:** `0o666` +* `mode` {integer} **Default:** `0o666` (readable and writable) * `callback` {Function} * `err` {Error} * `fd` {integer} @@ -2075,7 +2075,7 @@ The file is created if it does not exist. The file is created if it does not exist. `mode` sets the file mode (permission and sticky bits), but only if the file was -created. It defaults to `0o666` (readable and writable). +created. The callback gets two arguments `(err, fd)`. @@ -2728,7 +2728,7 @@ changes: Asynchronous symlink(2). No arguments other than a possible exception are given to the completion callback. The `type` argument can be set to `'dir'`, -`'file'`, or `'junction'` (default is `'file'`) and is only available on +`'file'`, or `'junction'` and is only available on Windows (ignored on other platforms). Note that Windows junction points require the destination path to be absolute. When using `'junction'`, the `target` argument will automatically be normalized to absolute path. @@ -2938,13 +2938,13 @@ changes: * `filename` {string|Buffer|URL} * `options` {string|Object} * `persistent` {boolean} Indicates whether the process should continue to run - as long as files are being watched. **Default:** `true` + as long as files are being watched. **Default:** `true`. * `recursive` {boolean} Indicates whether all subdirectories should be watched, or only the current directory. This applies when a directory is specified, and only on supported platforms (See [Caveats][]). **Default:** - `false` + `false`. * `encoding` {string} Specifies the character encoding to be used for the - filename passed to the listener. **Default:** `'utf8'` + filename passed to the listener. **Default:** `'utf8'`. * `listener` {Function|undefined} **Default:** `undefined` * `eventType` {string} * `filename` {string|Buffer} @@ -3057,8 +3057,7 @@ The `options` argument may be omitted. If provided, it should be an object. The `options` object may contain a boolean named `persistent` that indicates whether the process should continue to run as long as files are being watched. The `options` object may specify an `interval` property indicating how often the -target should be polled in milliseconds. The default is -`{ persistent: true, interval: 5007 }`. +target should be polled in milliseconds. The `listener` gets two arguments the current stat object and the previous stat object: @@ -3219,8 +3218,7 @@ changes: Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string or a buffer. -The `encoding` option is ignored if `data` is a buffer. It defaults -to `'utf8'`. +The `encoding` option is ignored if `data` is a buffer. Example: diff --git a/doc/api/http.md b/doc/api/http.md index 048c9b6b9a6714..aba1dde57d01b7 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -116,13 +116,13 @@ added: v0.3.4 Can have the following fields: * `keepAlive` {boolean} Keep sockets around even when there are no outstanding requests, so they can be used for future requests without - having to reestablish a TCP connection. Defaults to `false` + having to reestablish a TCP connection. **Default:** `false`. * `keepAliveMsecs` {number} When using the `keepAlive` option, specifies the [initial delay](net.html#net_socket_setkeepalive_enable_initialdelay) for TCP Keep-Alive packets. Ignored when the - `keepAlive` option is `false` or `undefined`. Defaults to `1000`. + `keepAlive` option is `false` or `undefined`. **Default:** `1000`. * `maxSockets` {number} Maximum number of sockets to allow per - host. Defaults to `Infinity`. + host. **Default:** `Infinity`. * `maxFreeSockets` {number} Maximum number of sockets to leave open in a free state. Only relevant if `keepAlive` is set to `true`. **Default:** `256`. @@ -225,7 +225,7 @@ added: v0.11.4 --> * `options` {Object} A set of options providing information for name generation - * `host` {string} A domain name or IP address of the server to issue the + * `host` {string} A domain name or IP address of the server to issue the request to * `port` {number} Port of remote server * `localAddress` {string} Local interface to bind for network connections @@ -331,8 +331,8 @@ added: v0.7.0 * `socket` {net.Socket} * `head` {Buffer} -Emitted each time a server responds to a request with a `CONNECT` method. If -this event is not being listened for, clients receiving a `CONNECT` method will +Emitted each time a server responds to a request with a `CONNECT` method. If +this event is not being listened for, clients receiving a `CONNECT` method will have their connections closed. A client and server pair demonstrating how to listen for the `'connect'` event: @@ -624,7 +624,7 @@ added: v0.5.9 --> * `timeout` {number} Milliseconds before a request times out. -* `callback` {Function} Optional function to be called when a timeout occurs. +* `callback` {Function} Optional function to be called when a timeout occurs. Same as binding to the `timeout` event. Once a socket is assigned to this request and is connected @@ -692,7 +692,7 @@ buffer. Returns `false` if all or part of the data was queued in user memory. added: v0.1.17 --> -This class inherits from [`net.Server`][] and has the following additional +This class inherits from [`net.Server`][] and has the following additional events: ### Event: 'checkContinue' @@ -707,9 +707,9 @@ Emitted each time a request with an HTTP `Expect: 100-continue` is received. If this event is not listened for, the server will automatically respond with a `100 Continue` as appropriate. -Handling this event involves calling [`response.writeContinue()`][] if the -client should continue to send the request body, or generating an appropriate -HTTP response (e.g. 400 Bad Request) if the client should not continue to send +Handling this event involves calling [`response.writeContinue()`][] if the +client should continue to send the request body, or generating an appropriate +HTTP response (e.g. 400 Bad Request) if the client should not continue to send the request body. Note that when this event is emitted and handled, the [`'request'`][] event will @@ -881,17 +881,16 @@ connections. added: v0.7.0 --> -* {number} Defaults to 2000. +* {number} **Default:** `2000` -Limits maximum incoming headers count, equal to 2000 by default. If set to 0 - -no limit will be applied. +Limits maximum incoming headers count. If set to 0 - no limit will be applied. ### server.setTimeout([msecs][, callback]) -* `msecs` {number} Defaults to 120000 (2 minutes). +* `msecs` {number} **Default:** `120000` (2 minutes) * `callback` {Function} Sets the timeout value for sockets, and emits a `'timeout'` event on @@ -912,7 +911,7 @@ Returns `server`. added: v0.9.12 --> -* {number} Timeout in milliseconds. Defaults to 120000 (2 minutes). +* {number} Timeout in milliseconds. **Default:** `120000` (2 minutes). The number of milliseconds of inactivity before a socket is presumed to have timed out. @@ -927,7 +926,7 @@ value only affects new connections to the server, not any existing connections. added: v8.0.0 --> -* {number} Timeout in milliseconds. Defaults to 5000 (5 seconds). +* {number} Timeout in milliseconds. **Default:** `5000` (5 seconds). The number of milliseconds of inactivity a server needs to wait for additional incoming data, after it has finished writing the last response, before a socket @@ -935,9 +934,9 @@ will be destroyed. If the server receives new data before the keep-alive timeout has fired, it will reset the regular inactivity timeout, i.e., [`server.timeout`][]. -A value of `0` will disable the keep-alive timeout behavior on incoming +A value of `0` will disable the keep-alive timeout behavior on incoming connections. -A value of `0` makes the http server behave similarly to Node.js versions prior +A value of `0` makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout. The socket timeout logic is set up on connection, so changing this value only @@ -1187,8 +1186,8 @@ response.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']); Attempting to set a header field name or value that contains invalid characters will result in a [`TypeError`][] being thrown. -When headers have been set with [`response.setHeader()`][], they will be merged -with any headers passed to [`response.writeHead()`][], with the headers passed +When headers have been set with [`response.setHeader()`][], they will be merged +with any headers passed to [`response.writeHead()`][], with the headers passed to [`response.writeHead()`][] given precedence. ```js @@ -1272,8 +1271,8 @@ added: v0.11.8 * {string} When using implicit headers (not calling [`response.writeHead()`][] explicitly), -this property controls the status message that will be sent to the client when -the headers get flushed. If this is left as `undefined` then the standard +this property controls the status message that will be sent to the client when +the headers get flushed. If this is left as `undefined` then the standard message for the status code will be used. Example: @@ -1291,7 +1290,7 @@ added: v0.1.29 --> * `chunk` {string|Buffer} -* `encoding` {string} +* `encoding` {string} **Default:** `'utf8'` * `callback` {Function} * Returns: {boolean} @@ -1307,8 +1306,7 @@ _must not_ include a message body. `chunk` can be a string or a buffer. If `chunk` is a string, the second parameter specifies how to encode it into a byte stream. -By default the `encoding` is `'utf8'`. `callback` will be called when this chunk -of data is flushed. +`callback` will be called when this chunk of data is flushed. This is the raw HTTP body and has nothing to do with higher-level multi-part body encodings that may be used. @@ -1329,7 +1327,7 @@ added: v0.3.0 --> Sends a HTTP/1.1 100 Continue message to the client, indicating that -the request body should be sent. See the [`'checkContinue'`][] event on +the request body should be sent. See the [`'checkContinue'`][] event on `Server`. ### response.writeHead(statusCode[, statusMessage][, headers]) @@ -1366,8 +1364,8 @@ be called before [`response.end()`][] is called. If [`response.write()`][] or [`response.end()`][] are called before calling this, the implicit/mutable headers will be calculated and call this function. -When headers have been set with [`response.setHeader()`][], they will be merged -with any headers passed to [`response.writeHead()`][], with the headers passed +When headers have been set with [`response.setHeader()`][], they will be merged +with any headers passed to [`response.writeHead()`][], with the headers passed to [`response.writeHead()`][] given precedence. ```js @@ -1397,7 +1395,7 @@ added: v0.1.17 An `IncomingMessage` object is created by [`http.Server`][] or [`http.ClientRequest`][] and passed as the first argument to the [`'request'`][] -and [`'response'`][] event respectively. It may be used to access response +and [`'response'`][] event respectively. It may be used to access response status, headers and data. It implements the [Readable Stream][] interface, as well as the @@ -1569,7 +1567,7 @@ added: v0.11.10 **Only valid for response obtained from [`http.ClientRequest`][].** -The HTTP response status message (reason phrase). E.G. `OK` or `Internal Server +The HTTP response status message (reason phrase). E.G. `OK` or `Internal Server Error`. ### message.trailers @@ -1680,11 +1678,11 @@ changes: --> - `options` {Object} * `IncomingMessage` {http.IncomingMessage} Specifies the IncomingMessage class - to be used. Useful for extending the original `IncomingMessage`. Defaults - to: `IncomingMessage` + to be used. Useful for extending the original `IncomingMessage`. + **Default:** `IncomingMessage`. * `ServerResponse` {http.ServerResponse} Specifies the ServerResponse class to - be used. Useful for extending the original `ServerResponse`. Defaults to: - `ServerResponse` + be used. Useful for extending the original `ServerResponse`. **Default:** + `ServerResponse`. - `requestListener` {Function} * Returns: {http.Server} @@ -1776,28 +1774,28 @@ changes: --> * `options` {Object | string | URL} - * `protocol` {string} Protocol to use. Defaults to `http:`. + * `protocol` {string} Protocol to use. **Default:** `http:`. * `host` {string} A domain name or IP address of the server to issue the - request to. Defaults to `localhost`. + request to. **Default:** `localhost`. * `hostname` {string} Alias for `host`. To support [`url.parse()`][], `hostname` is preferred over `host`. * `family` {number} IP address family to use when resolving `host` and `hostname`. Valid values are `4` or `6`. When unspecified, both IP v4 and v6 will be used. - * `port` {number} Port of remote server. Defaults to 80. + * `port` {number} Port of remote server. **Default:** `80`. * `localAddress` {string} Local interface to bind for network connections. * `socketPath` {string} Unix Domain Socket (use one of host:port or socketPath). - * `method` {string} A string specifying the HTTP request method. Defaults to + * `method` {string} A string specifying the HTTP request method. **Default:** `'GET'`. - * `path` {string} Request path. Defaults to `'/'`. Should include query - string if any. E.G. `'/index.html?page=12'`. An exception is thrown when - the request path contains illegal characters. Currently, only spaces are - rejected but that may change in the future. + * `path` {string} Request path. Should include query string if any. + E.G. `'/index.html?page=12'`. An exception is thrown when the request path + contains illegal characters. Currently, only spaces are rejected but that + may change in the future. **Default:** `'/'`. * `headers` {Object} An object containing request headers. * `auth` {string} Basic authentication i.e. `'user:password'` to compute an Authorization header. - * `agent` {http.Agent | boolean} Controls [`Agent`][] behavior. Possible + * `agent` {http.Agent | boolean} Controls [`Agent`][] behavior. Possible values: * `undefined` (default): use [`http.globalAgent`][] for this host and port. * `Agent` object: explicitly use the passed in `Agent`. diff --git a/doc/api/http2.md b/doc/api/http2.md index c422803c288f3d..d44c1f5a3c6502 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -677,7 +677,7 @@ added: v8.4.0 * `exclusive` {boolean} When `true` and `parent` identifies a parent Stream, the created stream is made the sole direct dependency of the parent, with all other existing dependents made a dependent of the newly created stream. - **Default:** `false` + **Default:** `false`. * `parent` {number} Specifies the numeric identifier of a stream the newly created stream is dependent on. * `weight` {number} Specifies the relative dependency of a stream in relation @@ -879,7 +879,7 @@ added: v8.4.0 --> * code {number} Unsigned 32-bit integer identifying the error code. **Default:** - `http2.constants.NGHTTP2_NO_ERROR` (`0x00`) + `http2.constants.NGHTTP2_NO_ERROR` (`0x00`). * `callback` {Function} An optional function registered to listen for the `'close'` event. @@ -924,7 +924,7 @@ added: v8.4.0 * `exclusive` {boolean} When `true` and `parent` identifies a parent Stream, this stream is made the sole direct dependency of the parent, with all other existing dependents made a dependent of this stream. **Default:** - `false` + `false`. * `parent` {number} Specifies the numeric identifier of a stream this stream is dependent on. * `weight` {number} Specifies the relative dependency of a stream in relation @@ -1148,7 +1148,7 @@ added: v8.4.0 * `exclusive` {boolean} When `true` and `parent` identifies a parent Stream, the created stream is made the sole direct dependency of the parent, with all other existing dependents made a dependent of the newly created stream. - **Default:** `false` + **Default:** `false`. * `parent` {number} Specifies the numeric identifier of a stream the newly created stream is dependent on. * `callback` {Function} Callback that is called once the push stream has been @@ -1655,20 +1655,20 @@ changes: * `options` {Object} * `maxDeflateDynamicTableSize` {number} Sets the maximum dynamic table size - for deflating header fields. **Default:** `4Kib` + for deflating header fields. **Default:** `4Kib`. * `maxSessionMemory`{number} Sets the maximum memory that the `Http2Session` is permitted to use. The value is expressed in terms of number of megabytes, - e.g. `1` equal 1 megabyte. The minimum value allowed is `1`. **Default:** - `10`. This is a credit based limit, existing `Http2Stream`s may cause this + e.g. `1` equal 1 megabyte. The minimum value allowed is `1`. + This is a credit based limit, existing `Http2Stream`s may cause this limit to be exceeded, but new `Http2Stream` instances will be rejected while this limit is exceeded. The current number of `Http2Stream` sessions, the current memory use of the header compression tables, current data queued to be sent, and unacknowledged PING and SETTINGS frames are all - counted towards the current limit. + counted towards the current limit. **Default:** `10`. * `maxHeaderListPairs` {number} Sets the maximum number of header entries. - **Default:** `128`. The minimum value is `4`. + The minimum value is `4`. **Default:** `128`. * `maxOutstandingPings` {number} Sets the maximum number of outstanding, - unacknowledged pings. The default is `10`. + unacknowledged pings. **Default:** `10`. * `maxSendHeaderBlockLength` {number} Sets the maximum allowed size for a serialized, compressed block of headers. Attempts to send headers that exceed this limit will result in a `'frameError'` event being emitted @@ -1694,7 +1694,7 @@ changes: * `peerMaxConcurrentStreams` {number} Sets the maximum number of concurrent streams for the remote peer as if a SETTINGS frame had been received. Will be overridden if the remote peer sets its own value for - `maxConcurrentStreams`. **Default:** `100` + `maxConcurrentStreams`. **Default:** `100`. * `selectPadding` {Function} When `options.paddingStrategy` is equal to `http2.constants.PADDING_STRATEGY_CALLBACK`, provides the callback function used to determine the padding. See [Using options.selectPadding][]. @@ -1702,18 +1702,18 @@ changes: remote peer upon connection. * `Http1IncomingMessage` {http.IncomingMessage} Specifies the IncomingMessage class to used for HTTP/1 fallback. Useful for extending the original - `http.IncomingMessage`. **Default:** `http.IncomingMessage` + `http.IncomingMessage`. **Default:** `http.IncomingMessage`. * `Http1ServerResponse` {http.ServerResponse} Specifies the ServerResponse class to used for HTTP/1 fallback. Useful for extending the original - `http.ServerResponse`. **Default:** `http.ServerResponse` + `http.ServerResponse`. **Default:** `http.ServerResponse`. * `Http2ServerRequest` {http2.Http2ServerRequest} Specifies the Http2ServerRequest class to use. Useful for extending the original `Http2ServerRequest`. - **Default:** `Http2ServerRequest` + **Default:** `Http2ServerRequest`. * `Http2ServerResponse` {http2.Http2ServerResponse} Specifies the Http2ServerResponse class to use. Useful for extending the original `Http2ServerResponse`. - **Default:** `Http2ServerResponse` + **Default:** `Http2ServerResponse`. * `onRequestHandler` {Function} See [Compatibility API][] * Returns: {Http2Server} @@ -1761,23 +1761,24 @@ changes: * `options` {Object} * `allowHTTP1` {boolean} Incoming client connections that do not support - HTTP/2 will be downgraded to HTTP/1.x when set to `true`. **Default:** - `false`. See the [`'unknownProtocol'`][] event. See [ALPN negotiation][]. + HTTP/2 will be downgraded to HTTP/1.x when set to `true`. + See the [`'unknownProtocol'`][] event. See [ALPN negotiation][]. + **Default:** `false`. * `maxDeflateDynamicTableSize` {number} Sets the maximum dynamic table size - for deflating header fields. **Default:** `4Kib` + for deflating header fields. **Default:** `4Kib`. * `maxSessionMemory`{number} Sets the maximum memory that the `Http2Session` is permitted to use. The value is expressed in terms of number of megabytes, - e.g. `1` equal 1 megabyte. The minimum value allowed is `1`. **Default:** - `10`. This is a credit based limit, existing `Http2Stream`s may cause this + e.g. `1` equal 1 megabyte. The minimum value allowed is `1`. This is a + credit based limit, existing `Http2Stream`s may cause this limit to be exceeded, but new `Http2Stream` instances will be rejected while this limit is exceeded. The current number of `Http2Stream` sessions, the current memory use of the header compression tables, current data queued to be sent, and unacknowledged PING and SETTINGS frames are all - counted towards the current limit. + counted towards the current limit. **Default:** `10`. * `maxHeaderListPairs` {number} Sets the maximum number of header entries. - **Default:** `128`. The minimum value is `4`. + The minimum value is `4`. **Default:** `128`. * `maxOutstandingPings` {number} Sets the maximum number of outstanding, - unacknowledged pings. The default is `10`. + unacknowledged pings. **Default:** `10`. * `maxSendHeaderBlockLength` {number} Sets the maximum allowed size for a serialized, compressed block of headers. Attempts to send headers that exceed this limit will result in a `'frameError'` event being emitted @@ -1803,7 +1804,7 @@ changes: * `peerMaxConcurrentStreams` {number} Sets the maximum number of concurrent streams for the remote peer as if a SETTINGS frame had been received. Will be overridden if the remote peer sets its own value for - `maxConcurrentStreams`. **Default:** `100` + `maxConcurrentStreams`. **Default:** `100`. * `selectPadding` {Function} When `options.paddingStrategy` is equal to `http2.constants.PADDING_STRATEGY_CALLBACK`, provides the callback function used to determine the padding. See [Using options.selectPadding][]. @@ -1856,20 +1857,20 @@ changes: * `authority` {string|URL} * `options` {Object} * `maxDeflateDynamicTableSize` {number} Sets the maximum dynamic table size - for deflating header fields. **Default:** `4Kib` + for deflating header fields. **Default:** `4Kib`. * `maxSessionMemory`{number} Sets the maximum memory that the `Http2Session` is permitted to use. The value is expressed in terms of number of megabytes, - e.g. `1` equal 1 megabyte. The minimum value allowed is `1`. **Default:** - `10`. This is a credit based limit, existing `Http2Stream`s may cause this + e.g. `1` equal 1 megabyte. The minimum value allowed is `1`. + This is a credit based limit, existing `Http2Stream`s may cause this limit to be exceeded, but new `Http2Stream` instances will be rejected while this limit is exceeded. The current number of `Http2Stream` sessions, the current memory use of the header compression tables, current data queued to be sent, and unacknowledged PING and SETTINGS frames are all - counted towards the current limit. + counted towards the current limit. **Default:** `10`. * `maxHeaderListPairs` {number} Sets the maximum number of header entries. - **Default:** `128`. The minimum value is `1`. + The minimum value is `1`. **Default:** `128`. * `maxOutstandingPings` {number} Sets the maximum number of outstanding, - unacknowledged pings. The default is `10`. + unacknowledged pings. **Default:** `10`. * `maxReservedRemoteStreams` {number} Sets the maximum number of reserved push streams the client will accept at any given time. Once the current number of currently reserved push streams exceeds reaches this limit, new push streams @@ -1899,7 +1900,7 @@ changes: * `peerMaxConcurrentStreams` {number} Sets the maximum number of concurrent streams for the remote peer as if a SETTINGS frame had been received. Will be overridden if the remote peer sets its own value for - `maxConcurrentStreams`. **Default:** `100` + `maxConcurrentStreams`. **Default:** `100`. * `selectPadding` {Function} When `options.paddingStrategy` is equal to `http2.constants.PADDING_STRATEGY_CALLBACK`, provides the callback function used to determine the padding. See [Using options.selectPadding][]. @@ -2042,16 +2043,16 @@ These objects are ordinary JavaScript objects containing the following properties. * `headerTableSize` {number} Specifies the maximum number of bytes used for - header compression. **Default:** `4,096 octets`. The minimum allowed - value is 0. The maximum allowed value is 232-1. + header compression. The minimum allowed value is 0. The maximum allowed value + is 232-1. **Default:** `4,096 octets`. * `enablePush` {boolean} Specifies `true` if HTTP/2 Push Streams are to be permitted on the `Http2Session` instances. * `initialWindowSize` {number} Specifies the *senders* initial window size - for stream-level flow control. **Default:** `65,535 bytes`. The minimum - allowed value is 0. The maximum allowed value is 232-1. + for stream-level flow control. The minimum allowed value is 0. The maximum + allowed value is 232-1. **Default:** `65,535 bytes`. * `maxFrameSize` {number} Specifies the size of the largest frame payload. - **Default:** `16,384 bytes`. The minimum allowed value is 16,384. The maximum - allowed value is 224-1. + The minimum allowed value is 16,384. The maximum allowed value + is 224-1. **Default:** `16,384 bytes`. * `maxConcurrentStreams` {number} Specifies the maximum number of concurrent streams permitted on an `Http2Session`. There is no default value which implies, at least theoretically, 231-1 streams may be open @@ -2059,7 +2060,7 @@ properties. is 0. The maximum allowed value is 231-1. * `maxHeaderListSize` {number} Specifies the maximum size (uncompressed octets) of header list that will be accepted. The minimum allowed value is 0. The - maximum allowed value is 232-1. **Default:** 65535. + maximum allowed value is 232-1. **Default:** `65535`. All additional properties on the settings object are ignored. diff --git a/doc/api/https.md b/doc/api/https.md index c9c4b86bc7360f..33c403dda20a7e 100644 --- a/doc/api/https.md +++ b/doc/api/https.md @@ -40,7 +40,7 @@ This method is identical to [`server.listen()`][] from [`net.Server`][]. -- `msecs` {number} Defaults to 120000 (2 minutes). +- `msecs` {number} **Default:** `120000` (2 minutes) - `callback` {Function} See [`http.Server#setTimeout()`][]. @@ -49,7 +49,7 @@ See [`http.Server#setTimeout()`][]. -- {number} Defaults to 120000 (2 minutes). +- {number} **Default:** `120000` (2 minutes) See [`http.Server#timeout`][]. @@ -57,7 +57,7 @@ See [`http.Server#timeout`][]. -- {number} Defaults to 5000 (5 seconds). +- {number} **Default:** `5000` (5 seconds) See [`http.Server#keepAliveTimeout`][]. @@ -160,9 +160,9 @@ changes: --> - `options` {Object | string | URL} Accepts all `options` from [`http.request()`][], with some differences in default values: - - `protocol` Defaults to `https:` - - `port` Defaults to `443`. - - `agent` Defaults to `https.globalAgent`. + - `protocol` **Default:** `https:` + - `port` **Default:** `443` + - `agent` **Default:** `https.globalAgent` - `callback` {Function} diff --git a/doc/api/inspector.md b/doc/api/inspector.md index 9dafdb7e1b3d6c..8a6dc188b08124 100644 --- a/doc/api/inspector.md +++ b/doc/api/inspector.md @@ -14,12 +14,12 @@ const inspector = require('inspector'); ## inspector.open([port[, host[, wait]]]) -* port {number} Port to listen on for inspector connections. Optional, - defaults to what was specified on the CLI. -* host {string} Host to listen on for inspector connections. Optional, - defaults to what was specified on the CLI. -* wait {boolean} Block until a client has connected. Optional, defaults - to false. +* `port` {number} Port to listen on for inspector connections. Optional. + **Default:** what was specified on the CLI. +* `host` {string} Host to listen on for inspector connections. Optional. + **Default:** what was specified on the CLI. +* `wait` {boolean} Block until a client has connected. Optional. + **Default:** `false`. Activate inspector on host and port. Equivalent to `node --inspect=[[host:]port]`, but can be done programmatically after node has diff --git a/doc/api/net.md b/doc/api/net.md index 723582f5dc4d90..8cc8bf5a65a728 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -383,11 +383,11 @@ Creates a new socket object. the given file descriptor, otherwise a new socket will be created. * `allowHalfOpen` {boolean} Indicates whether half-opened TCP connections are allowed. See [`net.createServer()`][] and the [`'end'`][] event - for details. **Default:** `false` + for details. **Default:** `false`. * `readable` {boolean} Allow reads on the socket when an `fd` is passed, - otherwise ignored. **Default:** `false` + otherwise ignored. **Default:** `false`. * `writable` {boolean} Allow writes on the socket when an `fd` is passed, - otherwise ignored. **Default:** `false` + otherwise ignored. **Default:** `false`. * Returns: {net.Socket} The newly created socket can be either a TCP socket or a streaming [IPC][] @@ -578,12 +578,13 @@ this only when implementing a custom Socket. For TCP connections, available `options` are: * `port` {number} Required. Port the socket should connect to. -* `host` {string} Host the socket should connect to. **Default:** `'localhost'` +* `host` {string} Host the socket should connect to. **Default:** `'localhost'`. * `localAddress` {string} Local address the socket should connect from. * `localPort` {number} Local port the socket should connect from. -* `family` {number}: Version of IP stack, can be either 4 or 6. **Default:** `4` +* `family` {number}: Version of IP stack, can be either `4` or `6`. + **Default:** `4`. * `hints` {number} Optional [`dns.lookup()` hints][]. -* `lookup` {Function} Custom lookup function. **Default:** [`dns.lookup()`][] +* `lookup` {Function} Custom lookup function. **Default:** [`dns.lookup()`][]. For [IPC][] connections, available `options` are: @@ -752,28 +753,29 @@ Set the encoding for the socket as a [Readable Stream][]. See added: v0.1.92 --> +* `enable` {boolean} **Default:** `false` +* `initialDelay` {number} **Default:** `0` * Returns: {net.Socket} The socket itself. Enable/disable keep-alive functionality, and optionally set the initial delay before the first keepalive probe is sent on an idle socket. -`enable` defaults to `false`. Set `initialDelay` (in milliseconds) to set the delay between the last data packet received and the first keepalive probe. Setting 0 for initialDelay will leave the value unchanged from the default -(or previous) setting. Defaults to `0`. +(or previous) setting. ### socket.setNoDelay([noDelay]) +* `noDelay` {boolean} **Default:** `true` * Returns: {net.Socket} The socket itself. Disables the Nagle algorithm. By default TCP connections use the Nagle algorithm, they buffer data before sending it off. Setting `true` for `noDelay` will immediately fire off data each time `socket.write()` is called. -`noDelay` defaults to `true`. ### socket.setTimeout(timeout[, callback]) -* `code` {integer} The exit code. Defaults to `0`. +* `code` {integer} The exit code. **Default:** `0`. The `process.exit()` method instructs Node.js to terminate the process synchronously with an exit status of `code`. If `code` is omitted, exit uses @@ -1209,7 +1209,7 @@ added: v0.0.6 * `pid` {number} A process ID * `signal` {string|number} The signal to send, either as a string or number. - Defaults to `'SIGTERM'`. + **Default:** `'SIGTERM'`. The `process.kill()` method sends the `signal` to the process identified by `pid`. diff --git a/doc/api/querystring.md b/doc/api/querystring.md index cbf503af916593..693bb0a8a40aea 100644 --- a/doc/api/querystring.md +++ b/doc/api/querystring.md @@ -46,15 +46,15 @@ changes: * `str` {string} The URL query string to parse * `sep` {string} The substring used to delimit key and value pairs in the - query string. Defaults to `'&'`. + query string. **Default:** `'&'`. * `eq` {string}. The substring used to delimit keys and values in the - query string. Defaults to `'='`. + query string. **Default:** `'='`. * `options` {Object} * `decodeURIComponent` {Function} The function to use when decoding - percent-encoded characters in the query string. Defaults to + percent-encoded characters in the query string. **Default:** `querystring.unescape()`. * `maxKeys` {number} Specifies the maximum number of keys to parse. - Defaults to `1000`. Specify `0` to remove key counting limitations. + Specify `0` to remove key counting limitations. **Default:** `1000`. The `querystring.parse()` method parses a URL query string (`str`) into a collection of key and value pairs. @@ -93,12 +93,12 @@ added: v0.1.25 * `obj` {Object} The object to serialize into a URL query string * `sep` {string} The substring used to delimit key and value pairs in the - query string. Defaults to `'&'`. + query string. **Default:** `'&'`. * `eq` {string}. The substring used to delimit keys and values in the - query string. Defaults to `'='`. + query string. **Default:** `'='`. * `options` * `encodeURIComponent` {Function} The function to use when converting - URL-unsafe characters to percent-encoding in the query string. Defaults to + URL-unsafe characters to percent-encoding in the query string. **Default:** `querystring.escape()`. The `querystring.stringify()` method produces a URL query string from a diff --git a/doc/api/readline.md b/doc/api/readline.md index 548a51f4c571fe..94151dfa62abc2 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -350,29 +350,29 @@ changes: --> * `options` {Object} - * `input` {stream.Readable} The [Readable][] stream to listen to. This option + * `input` {stream.Readable} The [Readable][] stream to listen to. This option is *required*. - * `output` {stream.Writable} The [Writable][] stream to write readline data + * `output` {stream.Writable} The [Writable][] stream to write readline data to. * `completer` {Function} An optional function used for Tab autocompletion. * `terminal` {boolean} `true` if the `input` and `output` streams should be treated like a TTY, and have ANSI/VT100 escape codes written to it. - Defaults to checking `isTTY` on the `output` stream upon instantiation. + **Default:** checking `isTTY` on the `output` stream upon instantiation. * `historySize` {number} Maximum number of history lines retained. To disable - the history set this value to `0`. This option makes sense only if - `terminal` is set to `true` by the user or by an internal `output` check, - otherwise the history caching mechanism is not initialized at all. - **Default:** `30` - * `prompt` {string} The prompt string to use. **Default:** `'> '` + the history set this value to `0`. This option makes sense only if + `terminal` is set to `true` by the user or by an internal `output` check, + otherwise the history caching mechanism is not initialized at all. + **Default:** `30`. + * `prompt` {string} The prompt string to use. **Default:** `'> '`. * `crlfDelay` {number} If the delay between `\r` and `\n` exceeds `crlfDelay` milliseconds, both `\r` and `\n` will be treated as separate - end-of-line input. `crlfDelay` will be coerced to a number no less than - `100`. It can be set to `Infinity`, in which case `\r` followed by `\n` - will always be considered a single newline (which may be reasonable for - [reading files][] with `\r\n` line delimiter). **Default:** `100` + end-of-line input. `crlfDelay` will be coerced to a number no less than + `100`. It can be set to `Infinity`, in which case `\r` followed by `\n` + will always be considered a single newline (which may be reasonable for + [reading files][] with `\r\n` line delimiter). **Default:** `100`. * `removeHistoryDuplicates` {boolean} If `true`, when a new input line added to the history list duplicates an older one, this removes the older line - from the list. **Default:** `false` + from the list. **Default:** `false`. The `readline.createInterface()` method creates a new `readline.Interface` instance. diff --git a/doc/api/repl.md b/doc/api/repl.md index b1469bdcda455f..dea26b9f17c9b5 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -427,15 +427,15 @@ changes: --> * `options` {Object|string} - * `prompt` {string} The input prompt to display. Defaults to `> ` + * `prompt` {string} The input prompt to display. **Default:** `> `. (with a trailing space). - * `input` {stream.Readable} The Readable stream from which REPL input will be - read. Defaults to `process.stdin`. + * `input` {stream.Readable} The Readable stream from which REPL input will be + read. **Default:** `process.stdin`. * `output` {stream.Writable} The Writable stream to which REPL output will be - written. Defaults to `process.stdout`. + written. **Default:** `process.stdout`. * `terminal` {boolean} If `true`, specifies that the `output` should be treated as a TTY terminal, and have ANSI/VT100 escape codes written to it. - Defaults to checking the value of the `isTTY` property on the `output` + **Default:** checking the value of the `isTTY` property on the `output` stream upon instantiation. * `eval` {Function} The function to be used when evaluating each given line of input. **Default:** an async wrapper for the JavaScript `eval()` @@ -443,17 +443,17 @@ changes: the input was incomplete and prompt for additional lines. * `useColors` {boolean} If `true`, specifies that the default `writer` function should include ANSI color styling to REPL output. If a custom - `writer` function is provided then this has no effect. Defaults to the + `writer` function is provided then this has no effect. **Default:** the REPL instances `terminal` value. * `useGlobal` {boolean} If `true`, specifies that the default evaluation function will use the JavaScript `global` as the context as opposed to creating a new separate context for the REPL instance. The node CLI REPL - sets this value to `true`. Defaults to `false`. + sets this value to `true`. **Default:** `false`. * `ignoreUndefined` {boolean} If `true`, specifies that the default writer will not output the return value of a command if it evaluates to - `undefined`. Defaults to `false`. + `undefined`. **Default:** `false`. * `writer` {Function} The function to invoke to format the output of each - command before writing to `output`. Defaults to [`util.inspect()`][]. + command before writing to `output`. **Default:** [`util.inspect()`][]. * `completer` {Function} An optional function used for custom Tab auto completion. See [`readline.InterfaceCompleter`][] for an example. * `replMode` {symbol} A flag that specifies whether the default evaluator @@ -467,7 +467,7 @@ changes: equivalent to `repl.REPL_MODE_SLOPPY` (documented above). * `breakEvalOnSigint` - Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is pressed. This cannot be used together - with a custom `eval` function. Defaults to `false`. + with a custom `eval` function. **Default:** `false`. The `repl.start()` method creates and starts a `repl.REPLServer` instance. @@ -510,11 +510,12 @@ environment variables: will be saved to the specified file rather than `.node_repl_history` in the user's home directory. Setting this value to `''` will disable persistent REPL history. Whitespace will be trimmed from the value. - - `NODE_REPL_HISTORY_SIZE` - Defaults to `1000`. Controls how many lines of - history will be persisted if history is available. Must be a positive number. - - `NODE_REPL_MODE` - May be any of `sloppy`, `strict`, or `magic`. Defaults - to `sloppy`, which will allow non-strict mode code to be run. `magic` is - **deprecated** and treated as an alias of `sloppy`. + - `NODE_REPL_HISTORY_SIZE` - Controls how many lines of history will be + persisted if history is available. Must be a positive number. + **Default:** `1000`. + - `NODE_REPL_MODE` - May be any of `sloppy`, `strict`, or `magic`. `magic` is + **deprecated** and treated as an alias of `sloppy`. **Default:** `sloppy`, + which will allow non-strict mode code to be run. ### Persistent History diff --git a/doc/api/stream.md b/doc/api/stream.md index 387a306a7b4903..2d032917bc7ab4 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -423,7 +423,7 @@ stream.write('data '); process.nextTick(() => stream.uncork()); ``` -If the [`writable.cork()`][] method is called multiple times on a stream, the +If the [`writable.cork()`][] method is called multiple times on a stream, the same number of calls to `writable.uncork()` must be called to flush the buffered data. @@ -619,7 +619,7 @@ possible states: When `readable.readableFlowing` is `null`, no mechanism for consuming the streams data is provided so the stream will not generate its data. While in this -state, attaching a listener for the `'data'` event, calling the +state, attaching a listener for the `'data'` event, calling the `readable.pipe()` method, or calling the `readable.resume()` method will switch `readable.readableFlowing` to `true`, causing the Readable to begin actively emitting events as data is generated. @@ -847,7 +847,7 @@ added: v0.9.4 * `destination` {stream.Writable} The destination for writing data * `options` {Object} Pipe options - * `end` {boolean} End the writer when the reader ends. Defaults to `true`. + * `end` {boolean} End the writer when the reader ends. **Default:** `true`. The `readable.pipe()` method attaches a [Writable][] stream to the `readable`, causing it to switch automatically into flowing mode and push all of its data @@ -1268,7 +1268,7 @@ on the type of stream being created, as detailed in the chart below:

- [_write][stream-_write], + [_write][stream-_write], [_writev][stream-_writev], [_final][stream-_final]

@@ -1283,8 +1283,8 @@ on the type of stream being created, as detailed in the chart below:

- [_read][stream-_read], - [_write][stream-_write], + [_read][stream-_read], + [_write][stream-_write], [_writev][stream-_writev], [_final][stream-_final]

@@ -1299,7 +1299,7 @@ on the type of stream being created, as detailed in the chart below:

- [_transform][stream-_transform], + [_transform][stream-_transform], [_flush][stream-_flush], [_final][stream-_final]

@@ -1344,16 +1344,16 @@ constructor and implement the `writable._write()` method. The * `options` {Object} * `highWaterMark` {number} Buffer level when - [`stream.write()`][stream-write] starts returning `false`. Defaults to + [`stream.write()`][stream-write] starts returning `false`. **Default:** `16384` (16kb), or `16` for `objectMode` streams. * `decodeStrings` {boolean} Whether or not to decode strings into Buffers before passing them to [`stream._write()`][stream-_write]. - Defaults to `true` + **Default:** `true`. * `objectMode` {boolean} Whether or not the [`stream.write(anyObj)`][stream-write] is a valid operation. When set, it becomes possible to write JavaScript values other than string, `Buffer` or `Uint8Array` if supported by the stream implementation. - Defaults to `false` + **Default:** `false`. * `write` {Function} Implementation for the [`stream._write()`][stream-_write] method. * `writev` {Function} Implementation for the @@ -1603,15 +1603,15 @@ constructor and implement the `readable._read()` method. * `options` {Object} * `highWaterMark` {number} The maximum [number of bytes][hwm-gotcha] to store in the internal buffer before ceasing to read from the underlying resource. - Defaults to `16384` (16kb), or `16` for `objectMode` streams + **Default:** `16384` (16kb), or `16` for `objectMode` streams. * `encoding` {string} If specified, then buffers will be decoded to - strings using the specified encoding. Defaults to `null` + strings using the specified encoding. **Default:** `null`. * `objectMode` {boolean} Whether this stream should behave as a stream of objects. Meaning that [`stream.read(n)`][stream-read] returns - a single value instead of a Buffer of size n. Defaults to `false` + a single value instead of a Buffer of size n. **Default:** `false`. * `read` {Function} Implementation for the [`stream._read()`][stream-_read] method. - * `destroy` {Function} Implementation for the + * `destroy` {Function} Implementation for the [`stream._destroy()`][readable-_destroy] method. ```js @@ -1851,15 +1851,13 @@ changes: * `options` {Object} Passed to both Writable and Readable constructors. Also has the following fields: - * `allowHalfOpen` {boolean} Defaults to `true`. If set to `false`, then - the stream will automatically end the writable side when the - readable side ends. - * `readableObjectMode` {boolean} Defaults to `false`. Sets `objectMode` - for readable side of the stream. Has no effect if `objectMode` - is `true`. - * `writableObjectMode` {boolean} Defaults to `false`. Sets `objectMode` - for writable side of the stream. Has no effect if `objectMode` - is `true`. + * `allowHalfOpen` {boolean} If set to `false`, then the stream will + automatically end the writable side when the readable side ends. + **Default:** `true`. + * `readableObjectMode` {boolean} Sets `objectMode` for readable side of the + stream. Has no effect if `objectMode` is `true`. **Default:** `false`. + * `writableObjectMode` {boolean} Sets `objectMode` for writable side of the + stream. Has no effect if `objectMode` is `true`. **Default:** `false`. * `readableHighWaterMark` {number} Sets `highWaterMark` for the readable side of the stream. Has no effect if `highWaterMark` is provided. * `writableHighWaterMark` {number} Sets `highWaterMark` for the writable side diff --git a/doc/api/string_decoder.md b/doc/api/string_decoder.md index cde81e6ae5ec2b..224d208e9cc889 100644 --- a/doc/api/string_decoder.md +++ b/doc/api/string_decoder.md @@ -48,7 +48,7 @@ added: v0.1.99 --> * `encoding` {string} The character encoding the `StringDecoder` will use. - Defaults to `'utf8'`. + **Default:** `'utf8'`. Creates a new `StringDecoder` instance. diff --git a/doc/api/tls.md b/doc/api/tls.md index 99ef062707ee4e..e66e03b9ead0c0 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -134,9 +134,9 @@ An `'error'` event is emitted on the [`tls.TLSSocket`][] instance when this threshold is exceeded. The limits are configurable: * `tls.CLIENT_RENEG_LIMIT` {number} Specifies the number of renegotiation - requests. Defaults to `3`. + requests. **Default:** `3`. * `tls.CLIENT_RENEG_WINDOW` {number} Specifies the time renegotiation window - in seconds. Defaults to `600` (10 minutes). + in seconds. **Default:** `600` (10 minutes). The default renegotiation limits should not be modified without a full understanding of the implications and risks. @@ -461,7 +461,7 @@ changes: * `options` {Object} * `isServer`: The SSL/TLS protocol is asymmetrical, TLSSockets must know if they are to behave as a server or a client. If `true` the TLS socket will be - instantiated as a server. Defaults to `false`. + instantiated as a server. **Default:** `false`. * `server` {net.Server} An optional [`net.Server`][] instance. * `requestCert`: Whether to authenticate the remote peer by requesting a certificate. Clients always request a server certificate. Servers @@ -744,9 +744,9 @@ added: v0.11.8 --> * `options` {Object} - * `rejectUnauthorized` {boolean} If not `false`, the server certificate is + * `rejectUnauthorized` {boolean} If not `false`, the server certificate is verified against the list of supplied CAs. An `'error'` event is emitted if - verification fails; `err.code` contains the OpenSSL error code. Defaults to + verification fails; `err.code` contains the OpenSSL error code. **Default:** `true`. * `requestCert` * `callback` {Function} A function that will be called when the renegotiation @@ -767,8 +767,8 @@ When running as the server, the socket will be destroyed with an error after added: v0.11.11 --> -* `size` {number} The maximum TLS fragment size. Defaults to `16384`. The - maximum value is `16384`. +* `size` {number} The maximum TLS fragment size. The maximum value is `16384`. + **Default:** `16384`. The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size. Returns `true` if setting the limit succeeded; `false` otherwise. @@ -852,7 +852,8 @@ changes: --> * `options` {Object} - * `host` {string} Host the client should connect to, defaults to 'localhost'. + * `host` {string} Host the client should connect to. **Default:** + `'localhost'`. * `port` {number} Port the client should connect to. * `path` {string} Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. @@ -865,9 +866,9 @@ changes: connection/disconnection/destruction of `socket` is the user's responsibility, calling `tls.connect()` will not cause `net.connect()` to be called. - * `rejectUnauthorized` {boolean} If not `false`, the server certificate is + * `rejectUnauthorized` {boolean} If not `false`, the server certificate is verified against the list of supplied CAs. An `'error'` event is emitted if - verification fails; `err.code` contains the OpenSSL error code. Defaults to + verification fails; `err.code` contains the OpenSSL error code. **Default:** `true`. * `NPNProtocols` {string[]|Buffer[]|Uint8Array[]|Buffer|Uint8Array} An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or @@ -893,12 +894,13 @@ changes: * `minDHSize` {number} Minimum size of the DH parameter in bits to accept a TLS connection. When a server offers a DH parameter with a size less than `minDHSize`, the TLS connection is destroyed and an error is thrown. - Defaults to `1024`. + **Default:** `1024`. * `secureContext`: Optional TLS context object created with [`tls.createSecureContext()`][]. If a `secureContext` is _not_ provided, one will be created by passing the entire `options` object to `tls.createSecureContext()`. - * `lookup`: {Function} Custom lookup function. Defaults to [`dns.lookup()`][]. + * `lookup`: {Function} Custom lookup function. **Default:** + [`dns.lookup()`][]. * ...: Optional [`tls.createSecureContext()`][] options that are used if the `secureContext` option is missing, otherwise they are ignored. * `callback` {Function} @@ -1020,7 +1022,7 @@ changes: as an array of unencrypted PFX buffers, or an array of objects in the form `{buf: [, passphrase: ]}`. The object form can only occur in an array. `object.passphrase` is optional. Encrypted PFX will be - decrypted with `object.passphrase` if provided, or `options.passphrase` if + decrypted with `object.passphrase` if provided, or `options.passphrase` if it is not. * `key` {string|string[]|Buffer|Buffer[]|Object[]} Optional private keys in PEM format. PEM allows the option of private keys being encrypted. Encrypted @@ -1065,10 +1067,10 @@ changes: * `ecdhCurve` {string} A string describing a named curve or a colon separated list of curve NIDs or names, for example `P-521:P-384:P-256`, to use for ECDH key agreement, or `false` to disable ECDH. Set to `auto` to select the - curve automatically. Defaults to [`tls.DEFAULT_ECDH_CURVE`]. Use - [`crypto.getCurves()`][] to obtain a list of available curve names. On - recent releases, `openssl ecparam -list_curves` will also display the name - and description of each available elliptic curve. + curve automatically. Use [`crypto.getCurves()`][] to obtain a list of + available curve names. On recent releases, `openssl ecparam -list_curves` + will also display the name and description of each available elliptic curve. + **Default:** [`tls.DEFAULT_ECDH_CURVE`]. * `clientCertEngine` {string} Optional name of an OpenSSL engine which can provide the client certificate. * `crl` {string|string[]|Buffer|Buffer[]} Optional PEM formatted @@ -1083,10 +1085,10 @@ changes: which is not usually necessary. This should be used carefully if at all! Value is a numeric bitmask of the `SSL_OP_*` options from [OpenSSL Options][]. - * `secureProtocol` {string} Optional SSL method to use, default is - `"SSLv23_method"`. The possible values are listed as [SSL_METHODS][], use - the function names as strings. For example, `"SSLv3_method"` to force SSL - version 3. + * `secureProtocol` {string} Optional SSL method to use. The possible values + are listed as [SSL_METHODS][], use the function names as strings. + For example, `'SSLv3_method'` to force SSL version 3. **Default:** + `'SSLv23_method'`. * `sessionIdContext` {string} Optional opaque identifier used by servers to ensure session state is not shared between applications. Unused by clients. @@ -1127,15 +1129,15 @@ changes: * `clientCertEngine` {string} Optional name of an OpenSSL engine which can provide the client certificate. * `handshakeTimeout` {number} Abort the connection if the SSL/TLS handshake - does not finish in the specified number of milliseconds. Defaults to - `120000` (120 seconds). A `'tlsClientError'` is emitted on the `tls.Server` - object whenever a handshake times out. + does not finish in the specified number of milliseconds. + A `'tlsClientError'` is emitted on the `tls.Server` object whenever + a handshake times out. **Default:** `120000` (120 seconds). * `requestCert` {boolean} If `true` the server will request a certificate from - clients that connect and attempt to verify that certificate. Defaults to + clients that connect and attempt to verify that certificate. **Default:** `false`. * `rejectUnauthorized` {boolean} If not `false` the server will reject any connection which is not authorized with the list of supplied CAs. This - option only has an effect if `requestCert` is `true`. Defaults to `true`. + option only has an effect if `requestCert` is `true`. **Default:** `true`. * `NPNProtocols` {string[]|Buffer[]|Uint8Array[]|Buffer|Uint8Array} An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or `Uint8Array` containing supported NPN protocols. `Buffer`s should have the @@ -1323,13 +1325,13 @@ changes: opened as a server. * `requestCert` {boolean} `true` to specify whether a server should request a certificate from a connecting client. Only applies when `isServer` is `true`. -* `rejectUnauthorized` {boolean} If not `false` a server automatically reject +* `rejectUnauthorized` {boolean} If not `false` a server automatically reject clients with invalid certificates. Only applies when `isServer` is `true`. * `options` * `secureContext`: An optional TLS context object from [`tls.createSecureContext()`][] * `isServer`: If `true` the TLS socket will be instantiated in server-mode. - Defaults to `false`. + **Default:** `false`. * `server` {net.Server} An optional [`net.Server`][] instance * `requestCert`: Optional, see [`tls.createServer()`][] * `rejectUnauthorized`: Optional, see [`tls.createServer()`][] diff --git a/doc/api/tty.md b/doc/api/tty.md index a3ade6656f3c19..193005c017dda7 100644 --- a/doc/api/tty.md +++ b/doc/api/tty.md @@ -126,8 +126,8 @@ is updated whenever the `'resize'` event is emitted. added: v9.9.0 --> -* `env` {object} A object containing the environment variables to check. - Defaults to `process.env`. +* `env` {Object} A object containing the environment variables to check. + **Default:** `process.env`. * Returns: {number} Returns: diff --git a/doc/api/url.md b/doc/api/url.md index 557b1a9dd81a9f..232d732ec159f7 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -815,14 +815,14 @@ added: v7.6.0 * `URL` {URL} A [WHATWG URL][] object * `options` {Object} * `auth` {boolean} `true` if the serialized URL string should include the - username and password, `false` otherwise. Defaults to `true`. + username and password, `false` otherwise. **Default:** `true`. * `fragment` {boolean} `true` if the serialized URL string should include the - fragment, `false` otherwise. Defaults to `true`. + fragment, `false` otherwise. **Default:** `true`. * `search` {boolean} `true` if the serialized URL string should include the - search query, `false` otherwise. Defaults to `true`. + search query, `false` otherwise. **Default:** `true`. * `unicode` {boolean} `true` if Unicode characters appearing in the host component of the URL string should be encoded directly as opposed to being - Punycode encoded. Defaults to `false`. + Punycode encoded. **Default:** `false`. Returns a customizable serialization of a URL String representation of a [WHATWG URL][] object. @@ -1055,12 +1055,12 @@ changes: * `parseQueryString` {boolean} If `true`, the `query` property will always be set to an object returned by the [`querystring`][] module's `parse()` method. If `false`, the `query` property on the returned URL object will be an - unparsed, undecoded string. Defaults to `false`. + unparsed, undecoded string. **Default:** `false`. * `slashesDenoteHost` {boolean} If `true`, the first token after the literal string `//` and preceding the next `/` will be interpreted as the `host`. For instance, given `//foo/bar`, the result would be `{host: 'foo', pathname: '/bar'}` rather than `{pathname: '//foo/bar'}`. - Defaults to `false`. + **Default:** `false`. The `url.parse()` method takes a URL string, parses it, and returns a URL object. diff --git a/doc/api/util.md b/doc/api/util.md index 366da705ecb817..13bfda7dfd3e9f 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -107,7 +107,7 @@ const debuglog = util.debuglog('foo-bar'); debuglog('hi there, it\'s foo-bar [%d]', 2333); ``` -if it is run with `NODE_DEBUG=foo*` in the environment, then it will output +if it is run with `NODE_DEBUG=foo*` in the environment, then it will output something like: ```txt FOO-BAR 3257: hi there, it's foo-bar [2333] @@ -121,7 +121,7 @@ environment variable: `NODE_DEBUG=fs,net,tls`. added: v0.8.0 --> -The `util.deprecate()` method wraps the given `function` or class in such a way +The `util.deprecate()` method wraps the given `function` or class in such a way that it is marked as deprecated. @@ -182,13 +182,13 @@ corresponding argument. Supported placeholders are: contains circular references. * `%o` - Object. A string representation of an object with generic JavaScript object formatting. - Similar to `util.inspect()` with options `{ showHidden: true, depth: 4, - showProxy: true }`. This will show the full object including non-enumerable + Similar to `util.inspect()` with options `{ showHidden: true, depth: 4, + showProxy: true }`. This will show the full object including non-enumerable symbols and properties. * `%O` - Object. A string representation of an object with generic JavaScript object formatting. Similar to `util.inspect()` without options. - This will show the full object not including non-enumerable symbols and + This will show the full object not including non-enumerable symbols and properties. * `%%` - single percent sign (`'%'`). This does not consume an argument. * Returns: {string} The formatted string @@ -343,32 +343,32 @@ changes: * `object` {any} Any JavaScript primitive or Object. * `options` {Object} * `showHidden` {boolean} If `true`, the `object`'s non-enumerable symbols and - properties will be included in the formatted result. Defaults to `false`. + properties will be included in the formatted result. **Default:** `false`. * `depth` {number} Specifies the number of times to recurse while formatting the `object`. This is useful for inspecting large complicated objects. Defaults to `2`. To make it recurse indefinitely pass `null`. * `colors` {boolean} If `true`, the output will be styled with ANSI color - codes. Defaults to `false`. Colors are customizable, see - [Customizing `util.inspect` colors][]. + codes. Colors are customizable, see [Customizing `util.inspect` colors][]. + **Default:** `false`. * `customInspect` {boolean} If `false`, then custom `inspect(depth, opts)` - functions will not be called. Defaults to `true`. + functions will not be called. **Default:** `true`. * `showProxy` {boolean} If `true`, then objects and functions that are `Proxy` objects will be introspected to show their `target` and `handler` - objects. Defaults to `false`. + objects. **Default:** `false`. * `maxArrayLength` {number} Specifies the maximum number of array and - `TypedArray` elements to include when formatting. Defaults to `100`. Set to - `null` to show all array elements. Set to `0` or negative to show no array - elements. + `TypedArray` elements to include when formatting. Set to `null` to show all + array elements. Set to `0` or negative to show no array elements. + **Default:** `100`. * `breakLength` {number} The length at which an object's keys are split across multiple lines. Set to `Infinity` to format an object as a single - line. Defaults to 60 for legacy compatibility. + line. **Default:** `60` for legacy compatibility. * `compact` {boolean} Setting this to `false` changes the default indentation to use a line break for each object key instead of lining up multiple properties in one line. It will also break text that is above the `breakLength` size into smaller and better readable chunks and indents objects the same as arrays. Note that no text will be reduced below 16 characters, no matter the `breakLength` size. For more information, see the - example below. Defaults to `true`. + example below. **Default:** `true`. The `util.inspect()` method returns a string representation of `object` that is primarily useful for debugging. Additional `options` may be passed that alter @@ -646,7 +646,7 @@ console.log(promisified === doSomething[util.promisify.custom]); This can be useful for cases where the original function does not follow the standard format of taking an error-first callback as the last argument. -For example, with a function that takes in `(foo, onSuccessCallback, +For example, with a function that takes in `(foo, onSuccessCallback, onErrorCallback)`: ```js @@ -757,15 +757,15 @@ is not supported. ### new TextDecoder([encoding[, options]]) * `encoding` {string} Identifies the `encoding` that this `TextDecoder` instance - supports. Defaults to `'utf-8'`. + supports. **Default:** `'utf-8'`. * `options` {Object} - * `fatal` {boolean} `true` if decoding failures are fatal. Defaults to - `false`. This option is only supported when ICU is enabled (see - [Internationalization][]). + * `fatal` {boolean} `true` if decoding failures are fatal. This option is only + supported when ICU is enabled (see [Internationalization][]). **Default:** + `false`. * `ignoreBOM` {boolean} When `true`, the `TextDecoder` will include the byte order mark in the decoded result. When `false`, the byte order mark will be removed from the output. This option is only used when `encoding` is - `'utf-8'`, `'utf-16be'` or `'utf-16le'`. Defaults to `false`. + `'utf-8'`, `'utf-16be'` or `'utf-16le'`. **Default:** `false`. Creates an new `TextDecoder` instance. The `encoding` may specify one of the supported encodings or an alias. @@ -776,7 +776,7 @@ supported encodings or an alias. Typed Array instance containing the encoded data. * `options` {Object} * `stream` {boolean} `true` if additional chunks of data are expected. - Defaults to `false`. + **Default:** `false`. * Returns: {string} Decodes the `input` and returns a string. If `options.stream` is `true`, any @@ -821,7 +821,7 @@ const uint8array = encoder.encode('this is some data'); ### textEncoder.encode([input]) -* `input` {string} The text to encode. Defaults to an empty string. +* `input` {string} The text to encode. **Default:** an empty string. * Returns: {Uint8Array} UTF-8 encodes the `input` string and returns a `Uint8Array` containing the diff --git a/doc/api/v8.md b/doc/api/v8.md index e9d3d15d014507..6c2f73ecc40e0d 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -285,13 +285,11 @@ by subclasses. #### serializer.\_setTreatArrayBufferViewsAsHostObjects(flag) -* `flag` {boolean} +* `flag` {boolean} **Default:** `false` Indicate whether to treat `TypedArray` and `DataView` objects as host objects, i.e. pass them to [`serializer._writeHostObject()`][]. -The default is not to treat those objects as host objects. - ### class: v8.Deserializer -`kind` defaults to `zlib.constants.Z_FULL_FLUSH`. +* `kind` **Default:** `zlib.constants.Z_FULL_FLUSH` Flush pending data. Don't call this frivolously, premature flushes negatively impact the effectiveness of the compression algorithm. diff --git a/tools/doc/json.js b/tools/doc/json.js index 87122cea70fd56..fe0d9526f5b7e6 100644 --- a/tools/doc/json.js +++ b/tools/doc/json.js @@ -399,10 +399,10 @@ function parseListItem(item) { } text = text.trim(); - const defaultExpr = /\(default\s*[:=]?\s*['"`]?([^, '"`]*)['"`]?\)/i; + const defaultExpr = /\s*\*\*Default:\*\*\s*([^]+)$/i; const def = text.match(defaultExpr); if (def) { - item.default = def[1]; + item.default = def[1].replace(/\.$/, ''); text = text.replace(defaultExpr, ''); }