From dbddd16ca8ef9fe49698414c0f5f6a0c0c2ccc9d Mon Sep 17 00:00:00 2001 From: Roman Reiss Date: Sat, 4 Feb 2017 16:15:33 +0100 Subject: [PATCH 1/4] doc: consistent case for primitive types PR-URL: https://github.com/nodejs/node/pull/11167 Reviewed-By: Timothy Gu Reviewed-By: James M Snell Reviewed-By: Joyee Cheung --- doc/api/buffer.md | 117 +++++++++++++------- doc/api/child_process.md | 148 ++++++++++++------------- doc/api/cluster.md | 22 ++-- doc/api/dgram.md | 46 ++++---- doc/api/dns.md | 10 +- doc/api/errors.md | 2 +- doc/api/events.md | 14 +-- doc/api/fs.md | 232 +++++++++++++++++++-------------------- doc/api/http.md | 84 +++++++------- doc/api/modules.md | 2 +- doc/api/net.md | 26 ++--- doc/api/os.md | 12 +- doc/api/path.md | 42 +++---- doc/api/process.md | 32 +++--- doc/api/punycode.md | 10 +- doc/api/querystring.md | 14 +-- doc/api/readline.md | 10 +- doc/api/repl.md | 8 +- doc/api/stream.md | 54 ++++----- doc/api/url.md | 54 +++++++-- doc/api/util.md | 10 +- 21 files changed, 515 insertions(+), 434 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 106d4f58f0c4fa..228dc4d22af46f 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -424,8 +424,8 @@ deprecated: v6.0.0 > Stability: 0 - Deprecated: > Use [`Buffer.from(string[, encoding])`][`Buffer.from(string)`] instead. -* `string` {String} String to encode -* `encoding` {String} The encoding of `string`. **Default:** `'utf8'` +* `string` {string} String to encode +* `encoding` {string} The encoding of `string`. **Default:** `'utf8'` Creates a new `Buffer` containing the given JavaScript string `string`. If provided, the `encoding` parameter identifies the character encoding of `string`. @@ -454,9 +454,9 @@ added: v5.10.0 --> * `size` {Integer} The desired length of the new `Buffer` -* `fill` {String | Buffer | Integer} A value to pre-fill the new `Buffer` with. +* `fill` {string | Buffer | Integer} A value to pre-fill the new `Buffer` with. **Default:** `0` -* `encoding` {String} If `fill` is a string, this is its encoding. +* `encoding` {string} If `fill` is a string, this is its encoding. **Default:** `'utf8'` Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the @@ -609,9 +609,9 @@ A `TypeError` will be thrown if `size` is not a number. added: v0.1.90 --> -* `string` {String | Buffer | TypedArray | DataView | ArrayBuffer} A value to +* `string` {string | Buffer | TypedArray | DataView | ArrayBuffer} A value to calculate the length of -* `encoding` {String} If `string` is a string, this is its encoding. +* `encoding` {string} If `string` is a string, this is its encoding. **Default:** `'utf8'` * Returns: {Integer} The number of bytes contained within `string` @@ -805,8 +805,8 @@ A `TypeError` will be thrown if `buffer` is not a `Buffer`. added: v5.10.0 --> -* `string` {String} A string to encode. -* `encoding` {String} The encoding of `string`. **Default:** `'utf8'` +* `string` {string} A string to encode. +* `encoding` {string} The encoding of `string`. **Default:** `'utf8'` Creates a new `Buffer` containing the given JavaScript string `string`. If provided, the `encoding` parameter identifies the character encoding of `string`. @@ -846,7 +846,7 @@ Returns `true` if `obj` is a `Buffer`, `false` otherwise. added: v0.9.1 --> -* `encoding` {String} A character encoding name to check +* `encoding` {string} A character encoding name to check * Returns: {Boolean} Returns `true` if `encoding` contains a supported character encoding, or `false` @@ -1075,10 +1075,10 @@ console.log(buf1.equals(buf3)); added: v0.5.0 --> -* `value` {String | Buffer | Integer} The value to fill `buf` with +* `value` {string | Buffer | Integer} The value to fill `buf` with * `offset` {Integer} Where to start filling `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. +* `encoding` {string} If `value` is a string, this is its encoding. **Default:** `'utf8'` * Returns: {Buffer} A reference to `buf` @@ -1107,6 +1107,47 @@ Example: Fill a `Buffer` with a two-byte character console.log(Buffer.allocUnsafe(3).fill('\u0222')); ``` +### buf.includes(value[, byteOffset][, encoding]) + + +* `value` {string | Buffer | Integer} What to search for +* `byteOffset` {Integer} Where to begin searching in `buf`. **Default:** `0` +* `encoding` {string} If `value` is a string, this is its encoding. + **Default:** `'utf8'` +* Returns: {Boolean} `true` if `value` was found in `buf`, `false` otherwise + +Equivalent to [`buf.indexOf() !== -1`][`buf.indexOf()`]. + +Examples: + +```js +const buf = Buffer.from('this is a buffer'); + +// Prints: true +console.log(buf.includes('this')); + +// Prints: true +console.log(buf.includes('is')); + +// Prints: true +console.log(buf.includes(Buffer.from('a buffer'))); + +// Prints: true +// (97 is the decimal ASCII value for 'a') +console.log(buf.includes(97)); + +// Prints: false +console.log(buf.includes(Buffer.from('a buffer example'))); + +// Prints: true +console.log(buf.includes(Buffer.from('a buffer example').slice(0, 8))); + +// Prints: false +console.log(buf.includes('this', 4)); +``` + ### buf.indexOf(value[, byteOffset][, encoding]) * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 8` -* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {Number} Reads a 64-bit double from `buf` at the specified `offset` with specified @@ -1421,7 +1462,7 @@ added: v0.11.15 --> * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {Number} Reads a 32-bit float from `buf` at the specified `offset` with specified @@ -1456,7 +1497,7 @@ added: v0.5.0 --> * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1` -* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {Integer} Reads a signed 8-bit integer from `buf` at the specified `offset`. @@ -1488,7 +1529,7 @@ added: v0.5.5 --> * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2` -* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {Integer} Reads a signed 16-bit integer from `buf` at the specified `offset` with @@ -1522,7 +1563,7 @@ added: v0.5.5 --> * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {Integer} Reads a signed 32-bit integer from `buf` at the specified `offset` with @@ -1557,7 +1598,7 @@ added: v0.11.15 * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength` * `byteLength` {Integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6` -* `noAssert` {Boolean} Skip `offset` and `byteLength` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` and `byteLength` validation? **Default:** `false` * Returns: {Integer} Reads `byteLength` number of bytes from `buf` at the specified `offset` @@ -1588,7 +1629,7 @@ added: v0.5.0 --> * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1` -* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {Integer} Reads an unsigned 8-bit integer from `buf` at the specified `offset`. @@ -1618,7 +1659,7 @@ added: v0.5.5 --> * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2` -* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {Integer} Reads an unsigned 16-bit integer from `buf` at the specified `offset` with @@ -1656,7 +1697,7 @@ added: v0.5.5 --> * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {Integer} Reads an unsigned 32-bit integer from `buf` at the specified `offset` with @@ -1689,7 +1730,7 @@ added: v0.11.15 * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength` * `byteLength` {Integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6` -* `noAssert` {Boolean} Skip `offset` and `byteLength` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` and `byteLength` validation? **Default:** `false` * Returns: {Integer} Reads `byteLength` number of bytes from `buf` at the specified `offset` @@ -1871,7 +1912,7 @@ for working with 64-bit floats. added: v0.1.90 --> -* `encoding` {String} The character encoding to decode to. **Default:** `'utf8'` +* `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`] @@ -1981,10 +2022,10 @@ for (const value of buf) { added: v0.1.90 --> -* `string` {String} String to be written to `buf` +* `string` {string} String to be written to `buf` * `offset` {Integer} Where to start writing `string`. **Default:** `0` * `length` {Integer} How many bytes to write. **Default:** `buf.length - offset` -* `encoding` {String} The character encoding of `string`. **Default:** `'utf8'` +* `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`. @@ -2009,9 +2050,9 @@ console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`); added: v0.11.15 --> -* `value` {Number} Number to be written to `buf` +* `value` {number} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 8` -* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian @@ -2044,9 +2085,9 @@ console.log(buf); added: v0.11.15 --> -* `value` {Number} Number to be written to `buf` +* `value` {number} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian @@ -2080,7 +2121,7 @@ added: v0.5.0 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1` -* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset`. `value` *should* be a valid @@ -2112,7 +2153,7 @@ added: v0.5.5 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2` -* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian @@ -2145,7 +2186,7 @@ added: v0.5.5 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian @@ -2179,7 +2220,7 @@ added: v0.11.15 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - byteLength` * `byteLength` {Integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6` -* `noAssert` {Boolean} Skip `value`, `offset`, and `byteLength` validation? +* `noAssert` {boolean} Skip `value`, `offset`, and `byteLength` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written @@ -2213,7 +2254,7 @@ added: v0.5.0 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1` -* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset`. `value` *should* be a @@ -2245,7 +2286,7 @@ added: v0.5.5 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2` -* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian @@ -2282,7 +2323,7 @@ added: v0.5.5 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian @@ -2318,7 +2359,7 @@ added: v0.5.5 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - byteLength` * `byteLength` {Integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6` -* `noAssert` {Boolean} Skip `value`, `offset`, and `byteLength` validation? +* `noAssert` {boolean} Skip `value`, `offset`, and `byteLength` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written diff --git a/doc/api/child_process.md b/doc/api/child_process.md index d7a94e7debb2ec..d91a1a5e5e60df 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -125,25 +125,25 @@ exec('"my script.cmd" a b', (err, stdout, stderr) => { added: v0.1.90 --> -* `command` {String} The command to run, with space-separated arguments +* `command` {string} The command to run, with space-separated arguments * `options` {Object} - * `cwd` {String} Current working directory of the child process + * `cwd` {string} Current working directory of the child process * `env` {Object} Environment key-value pairs - * `encoding` {String} (Default: `'utf8'`) - * `shell` {String} Shell to execute the command with + * `encoding` {string} (Default: `'utf8'`) + * `shell` {string} Shell to execute the command with (Default: `'/bin/sh'` on UNIX, `'cmd.exe'` on Windows, The shell should understand the `-c` switch on UNIX or `/s /c` on Windows. On Windows, command line parsing should be compatible with `cmd.exe`.) - * `timeout` {Number} (Default: `0`) + * `timeout` {number} (Default: `0`) * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on stdout or stderr - if exceeded child process is killed (Default: `200*1024`) - * `killSignal` {String|Integer} (Default: `'SIGTERM'`) - * `uid` {Number} Sets the user identity of the process. (See setuid(2).) - * `gid` {Number} Sets the group identity of the process. (See setgid(2).) + * `killSignal` {string|Integer} (Default: `'SIGTERM'`) + * `uid` {number} Sets the user identity of the process. (See setuid(2).) + * `gid` {number} Sets the group identity of the process. (See setgid(2).) * `callback` {Function} called with the output when process terminates * `error` {Error} - * `stdout` {String|Buffer} - * `stderr` {String|Buffer} + * `stdout` {string|Buffer} + * `stderr` {string|Buffer} * Returns: {ChildProcess} Spawns a shell then executes the `command` within that shell, buffering any @@ -205,22 +205,22 @@ replace the existing process and uses a shell to execute the command.* added: v0.1.91 --> -* `file` {String} The name or path of the executable file to run +* `file` {string} The name or path of the executable file to run * `args` {Array} List of string arguments * `options` {Object} - * `cwd` {String} Current working directory of the child process + * `cwd` {string} Current working directory of the child process * `env` {Object} Environment key-value pairs - * `encoding` {String} (Default: `'utf8'`) - * `timeout` {Number} (Default: `0`) + * `encoding` {string} (Default: `'utf8'`) + * `timeout` {number} (Default: `0`) * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on stdout or stderr - if exceeded child process is killed (Default: `200*1024`) - * `killSignal` {String|Integer} (Default: `'SIGTERM'`) - * `uid` {Number} Sets the user identity of the process. (See setuid(2).) - * `gid` {Number} Sets the group identity of the process. (See setgid(2).) + * `killSignal` {string|Integer} (Default: `'SIGTERM'`) + * `uid` {number} Sets the user identity of the process. (See setuid(2).) + * `gid` {number} Sets the group identity of the process. (See setgid(2).) * `callback` {Function} called with the output when process terminates * `error` {Error} - * `stdout` {String|Buffer} - * `stderr` {String|Buffer} + * `stdout` {string|Buffer} + * `stderr` {string|Buffer} * Returns: {ChildProcess} The `child_process.execFile()` function is similar to [`child_process.exec()`][] @@ -253,15 +253,15 @@ encoding, `Buffer` objects will be passed to the callback instead. added: v0.5.0 --> -* `modulePath` {String} The module to run in the child +* `modulePath` {string} The module to run in the child * `args` {Array} List of string arguments * `options` {Object} - * `cwd` {String} Current working directory of the child process + * `cwd` {string} Current working directory of the child process * `env` {Object} Environment key-value pairs - * `execPath` {String} Executable used to create the child process + * `execPath` {string} Executable used to create the child process * `execArgv` {Array} List of string arguments passed to the executable (Default: `process.execArgv`) - * `silent` {Boolean} If `true`, stdin, stdout, and stderr of the child will be + * `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`) @@ -269,8 +269,8 @@ added: v0.5.0 [`stdio`][] option. When this option is provided, it overrides `silent`. The array must contain exactly one item with value `'ipc'` or an error will be thrown. For instance `[0, 1, 2, 'ipc']`. - * `uid` {Number} Sets the user identity of the process. (See setuid(2).) - * `gid` {Number} Sets the group identity of the process. (See setgid(2).) + * `uid` {number} Sets the user identity of the process. (See setuid(2).) + * `gid` {number} Sets the group identity of the process. (See setgid(2).) * Returns: {ChildProcess} The `child_process.fork()` method is a special case of @@ -304,21 +304,21 @@ not clone the current process.* added: v0.1.90 --> -* `command` {String} The command to run +* `command` {string} The command to run * `args` {Array} List of string arguments * `options` {Object} - * `cwd` {String} Current working directory of the child process + * `cwd` {string} Current working directory of the child process * `env` {Object} Environment key-value pairs - * `argv0` {String} Explicitly set the value of `argv[0]` sent to the child + * `argv0` {string} Explicitly set the value of `argv[0]` sent to the child process. This will be set to `command` if not specified. - * `stdio` {Array|String} Child's stdio configuration. (See + * `stdio` {Array|string} Child's stdio configuration. (See [`options.stdio`][`stdio`]) - * `detached` {Boolean} Prepare child to run independently of its parent + * `detached` {boolean} Prepare child to run independently of its parent process. Specific behavior depends on the platform, see [`options.detached`][]) - * `uid` {Number} Sets the user identity of the process. (See setuid(2).) - * `gid` {Number} Sets the group identity of the process. (See setgid(2).) - * `shell` {Boolean|String} If `true`, runs `command` inside of a shell. Uses + * `uid` {number} Sets the user identity of the process. (See setuid(2).) + * `gid` {number} Sets the group identity of the process. (See setgid(2).) + * `shell` {boolean|string} If `true`, runs `command` inside of a shell. Uses `'/bin/sh'` on UNIX, and `'cmd.exe'` on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX, or `/s /c` on Windows. Defaults to `false` (no shell). @@ -576,27 +576,27 @@ configuration at startup. added: v0.11.12 --> -* `file` {String} The name or path of the executable file to run +* `file` {string} The name or path of the executable file to run * `args` {Array} List of string arguments * `options` {Object} - * `cwd` {String} Current working directory of the child process - * `input` {String|Buffer} The value which will be passed as stdin to the + * `cwd` {string} Current working directory of the child process + * `input` {string|Buffer} The value which will be passed as stdin to the spawned process - supplying this value will override `stdio[0]` - * `stdio` {String | Array} Child's stdio configuration. (Default: `'pipe'`) + * `stdio` {string | Array} Child's stdio configuration. (Default: `'pipe'`) - `stderr` by default will be output to the parent process' stderr unless `stdio` is specified * `env` {Object} Environment key-value pairs - * `uid` {Number} Sets the user identity of the process. (See setuid(2).) - * `gid` {Number} Sets the group identity of the process. (See setgid(2).) - * `timeout` {Number} In milliseconds the maximum amount of time the process + * `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`) - * `killSignal` {String|Integer} The signal value to be used when the spawned + * `killSignal` {string|Integer} The signal value to be used when the spawned process will be killed. (Default: `'SIGTERM'`) * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on stdout or stderr - if exceeded child process is killed - * `encoding` {String} The encoding used for all stdio inputs and outputs. (Default: `'buffer'`) -* Returns: {Buffer|String} The stdout from the command + * `encoding` {string} The encoding used for all stdio inputs and outputs. (Default: `'buffer'`) +* Returns: {Buffer|string} The stdout from the command The `child_process.execFileSync()` method is generally identical to [`child_process.execFile()`][] with the exception that the method will not return @@ -615,31 +615,31 @@ throw. The [`Error`][] object will contain the entire result from added: v0.11.12 --> -* `command` {String} The command to run +* `command` {string} The command to run * `options` {Object} - * `cwd` {String} Current working directory of the child process - * `input` {String|Buffer} The value which will be passed as stdin to the + * `cwd` {string} Current working directory of the child process + * `input` {string|Buffer} The value which will be passed as stdin to the spawned process - supplying this value will override `stdio[0]` - * `stdio` {String | Array} Child's stdio configuration. (Default: `'pipe'`) + * `stdio` {string | Array} Child's stdio configuration. (Default: `'pipe'`) - `stderr` by default will be output to the parent process' stderr unless `stdio` is specified * `env` {Object} Environment key-value pairs - * `shell` {String} Shell to execute the command with + * `shell` {string} Shell to execute the command with (Default: `'/bin/sh'` on UNIX, `'cmd.exe'` on Windows, The shell should understand the `-c` switch on UNIX or `/s /c` on Windows. On Windows, command line parsing should be compatible with `cmd.exe`.) - * `uid` {Number} Sets the user identity of the process. (See setuid(2).) - * `gid` {Number} Sets the group identity of the process. (See setgid(2).) - * `timeout` {Number} In milliseconds the maximum amount of time the process + * `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`) - * `killSignal` {String|Integer} The signal value to be used when the spawned + * `killSignal` {string|Integer} The signal value to be used when the spawned process will be killed. (Default: `'SIGTERM'`) * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on stdout or stderr - if exceeded child process is killed - * `encoding` {String} The encoding used for all stdio inputs and outputs. + * `encoding` {string} The encoding used for all stdio inputs and outputs. (Default: `'buffer'`) -* Returns: {Buffer|String} The stdout from the command +* Returns: {Buffer|string} The stdout from the command The `child_process.execSync()` method is generally identical to [`child_process.exec()`][] with the exception that the method will not return until @@ -662,36 +662,36 @@ execution.** added: v0.11.12 --> -* `command` {String} The command to run +* `command` {string} The command to run * `args` {Array} List of string arguments * `options` {Object} - * `cwd` {String} Current working directory of the child process - * `input` {String|Buffer} The value which will be passed as stdin to the + * `cwd` {string} Current working directory of the child process + * `input` {string|Buffer} The value which will be passed as stdin to the spawned process - supplying this value will override `stdio[0]` - * `stdio` {String | Array} Child's stdio configuration. + * `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 + * `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`) - * `killSignal` {String|Integer} The signal value to be used when the spawned + * `killSignal` {string|Integer} The signal value to be used when the spawned process will be killed. (Default: `'SIGTERM'`) * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on stdout or stderr - if exceeded child process is killed - * `encoding` {String} The encoding used for all stdio inputs and outputs. + * `encoding` {string} The encoding used for all stdio inputs and outputs. (Default: `'buffer'`) - * `shell` {Boolean|String} If `true`, runs `command` inside of a shell. Uses + * `shell` {boolean|string} If `true`, runs `command` inside of a shell. Uses `'/bin/sh'` on UNIX, and `'cmd.exe'` on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX, or `/s /c` on Windows. Defaults to `false` (no shell). * Returns: {Object} - * `pid` {Number} Pid of the child process + * `pid` {number} Pid of the child process * `output` {Array} Array of results from stdio output - * `stdout` {Buffer|String} The contents of `output[1]` - * `stderr` {Buffer|String} The contents of `output[2]` - * `status` {Number} The exit code of the child process - * `signal` {String} The signal used to kill the child process + * `stdout` {Buffer|string} The contents of `output[1]` + * `stderr` {Buffer|string} The contents of `output[2]` + * `status` {number} The exit code of the child process + * `signal` {string} The signal used to kill the child process * `error` {Error} The error object if the child process failed or timed out The `child_process.spawnSync()` method is generally identical to @@ -724,8 +724,8 @@ instances of `ChildProcess`. added: v0.7.7 --> -* `code` {Number} the exit code if the child exited on its own. -* `signal` {String} the signal by which the child process was terminated. +* `code` {number} the exit code if the child exited on its own. +* `signal` {string} the signal by which the child process was terminated. The `'close'` event is emitted when the stdio streams of a child process have been closed. This is distinct from the [`'exit'`][] event, since multiple @@ -762,8 +762,8 @@ See also [`child.kill()`][] and [`child.send()`][]. added: v0.1.90 --> -* `code` {Number} the exit code if the child exited on its own. -* `signal` {String} the signal by which the child process was terminated. +* `code` {number} the exit code if the child exited on its own. +* `signal` {string} the signal by which the child process was terminated. The `'exit'` event is emitted after the child process ends. If the process exited, `code` is the final exit code of the process, otherwise `null`. If the @@ -827,7 +827,7 @@ within the child process to close the IPC channel as well. added: v0.1.90 --> -* `signal` {String} +* `signal` {string} The `child.kill()` methods sends a signal to the child process. If no argument is given, the process will be sent the `'SIGTERM'` signal. See signal(7) for diff --git a/doc/api/cluster.md b/doc/api/cluster.md index 01a2aaf6a8cc86..850881d787bf14 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -148,8 +148,8 @@ In a worker you can also use `process.on('error')`. added: v0.11.2 --> -* `code` {Number} the exit code, if it exited normally. -* `signal` {String} the name of the signal (e.g. `'SIGHUP'`) that caused +* `code` {number} the exit code, if it exited normally. +* `signal` {string} the name of the signal (e.g. `'SIGHUP'`) that caused the process to be killed. Similar to the `cluster.on('exit')` event, but specific to this worker. @@ -382,7 +382,7 @@ because of exiting or being signaled). Otherwise, it returns `false`. added: v0.9.12 --> -* `signal` {String} Name of the kill signal to send to the worker +* `signal` {string} Name of the kill signal to send to the worker process. This function will kill the worker. In the master, it does this by disconnecting @@ -502,8 +502,8 @@ added: v0.7.9 --> * `worker` {cluster.Worker} -* `code` {Number} the exit code, if it exited normally. -* `signal` {String} the name of the signal (e.g. `'SIGHUP'`) that caused +* `code` {number} the exit code, if it exited normally. +* `signal` {string} the name of the signal (e.g. `'SIGHUP'`) that caused the process to be killed. When any of the workers die the cluster module will emit the `'exit'` event. @@ -713,16 +713,16 @@ added: v0.7.1 * {Object} * `execArgv` {Array} list of string arguments passed to the Node.js executable. (Default=`process.execArgv`) - * `exec` {String} file path to worker file. (Default=`process.argv[1]`) + * `exec` {string} file path to worker file. (Default=`process.argv[1]`) * `args` {Array} string arguments passed to worker. (Default=`process.argv.slice(2)`) - * `silent` {Boolean} whether or not to send output to parent's stdio. + * `silent` {boolean} whether or not to send output to parent's stdio. (Default=`false`) * `stdio` {Array} Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must contain an `'ipc'` entry. When this option is provided, it overrides `silent`. - * `uid` {Number} Sets the user identity of the process. (See setuid(2).) - * `gid` {Number} Sets the group identity of the process. (See setgid(2).) + * `uid` {number} Sets the user identity of the process. (See setuid(2).) + * `gid` {number} Sets the group identity of the process. (See setgid(2).) After calling `.setupMaster()` (or `.fork()`) this settings object will contain the settings, including the default values. @@ -735,10 +735,10 @@ added: v0.7.1 --> * `settings` {Object} - * `exec` {String} file path to worker file. (Default=`process.argv[1]`) + * `exec` {string} file path to worker file. (Default=`process.argv[1]`) * `args` {Array} string arguments passed to worker. (Default=`process.argv.slice(2)`) - * `silent` {Boolean} whether or not to send output to parent's stdio. + * `silent` {boolean} whether or not to send output to parent's stdio. (Default=`false`) * `stdio` {Array} Configures the stdio of forked processes. When this option is provided, it overrides `silent`. diff --git a/doc/api/dgram.md b/doc/api/dgram.md index 2e214beb2ff7d2..2d996ce0c6b058 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -74,18 +74,18 @@ The `'message'` event is emitted when a new datagram is available on a socket. The event handler function is passed two arguments: `msg` and `rinfo`. * `msg` {Buffer} - The message * `rinfo` {Object} - Remote address information - * `address` {String} The sender address - * `family` {String} The address family (`'IPv4'` or `'IPv6'`) - * `port` {Number} The sender port - * `size` {Number} The message size + * `address` {string} The sender address + * `family` {string} The address family (`'IPv4'` or `'IPv6'`) + * `port` {number} The sender port + * `size` {number} The message size ### socket.addMembership(multicastAddress[, multicastInterface]) -* `multicastAddress` {String} -* `multicastInterface` {String}, Optional +* `multicastAddress` {string} +* `multicastInterface` {string}, Optional Tells the kernel to join a multicast group at the given `multicastAddress` and `multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the @@ -107,8 +107,8 @@ properties. added: v0.1.99 --> -* `port` {Number} - Integer, Optional -* `address` {String}, Optional +* `port` {number} - Integer, Optional +* `address` {string}, Optional * `callback` {Function} with no parameters, Optional. Called when binding is complete. @@ -160,9 +160,9 @@ added: v0.11.14 --> * `options` {Object} - Required. Supports the following properties: - * `port` {Number} - Optional. - * `address` {String} - Optional. - * `exclusive` {Boolean} - Optional. + * `port` {number} - Optional. + * `address` {string} - Optional. + * `exclusive` {boolean} - Optional. * `callback` {Function} - Optional. For UDP sockets, causes the `dgram.Socket` to listen for datagram @@ -214,8 +214,8 @@ provided, it is added as a listener for the [`'close'`][] event. added: v0.6.9 --> -* `multicastAddress` {String} -* `multicastInterface` {String}, Optional +* `multicastAddress` {string} +* `multicastInterface` {string}, Optional Instructs the kernel to leave a multicast group at `multicastAddress` using the `IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the @@ -230,11 +230,11 @@ drop membership on all valid interfaces. added: v0.1.99 --> -* `msg` {Buffer|String|Array} Message to be sent -* `offset` {Number} Integer. Optional. Offset in the buffer where the message starts. -* `length` {Number} Integer. Optional. Number of bytes in the message. -* `port` {Number} Integer. Destination port. -* `address` {String} Destination hostname or IP address. +* `msg` {Buffer|string|array} Message to be sent +* `offset` {number} Integer. Optional. Offset in the buffer where the message starts. +* `length` {number} Integer. Optional. Number of bytes in the message. +* `port` {number} Integer. Destination port. +* `address` {string} Destination hostname or IP address. * `callback` {Function} Called when the message has been sent. Optional. Broadcasts a datagram on the socket. The destination `port` and `address` must @@ -330,7 +330,7 @@ source that the data did not reach its intended recipient. added: v0.6.9 --> -* `flag` {Boolean} +* `flag` {boolean} Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP packets may be sent to a local interface's broadcast address. @@ -340,7 +340,7 @@ packets may be sent to a local interface's broadcast address. added: v0.3.8 --> -* `flag` {Boolean} +* `flag` {boolean} Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`, multicast packets will also be received on the local interface. @@ -350,7 +350,7 @@ multicast packets will also be received on the local interface. added: v0.3.8 --> -* `ttl` {Number} Integer +* `ttl` {number} Integer Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for "Time to Live", in this context it specifies the number of IP hops that a @@ -366,7 +366,7 @@ between 0 and 255. The default on most systems is `1` but can vary. added: v0.1.101 --> -* `ttl` {Number} Integer +* `ttl` {number} Integer Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live", in this context it specifies the number of IP hops that a packet is allowed to @@ -463,7 +463,7 @@ and `udp6` sockets). The bound address and port can be retrieved using added: v0.1.99 --> -* `type` {String} - Either 'udp4' or 'udp6' +* `type` {string} - Either 'udp4' or 'udp6' * `callback` {Function} - Attached as a listener to `'message'` events. Optional * Returns: {dgram.Socket} diff --git a/doc/api/dns.md b/doc/api/dns.md index cdb468de232136..301daaa6dce95d 100644 --- a/doc/api/dns.md +++ b/doc/api/dns.md @@ -74,7 +74,7 @@ an integer, then it must be `4` or `6`. Alternatively, `options` can be an object containing these properties: -* `family` {Number} - The record family. If present, must be the integer +* `family` {number} - The record family. If present, must be the integer `4` or `6`. If not provided, both IP v4 and v6 addresses are accepted. * `hints`: {Number} - If present, it should be one or more of the supported `getaddrinfo` flags. If `hints` is not provided, then no flags are passed to @@ -205,9 +205,9 @@ Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the will contain an array of IPv4 addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`). -* `hostname` {String} Hostname to resolve. +* `hostname` {string} Hostname to resolve. * `options` {Object} - * `ttl` {Boolean} Retrieve the Time-To-Live value (TTL) of each record. + * `ttl` {boolean} Retrieve the Time-To-Live value (TTL) of each record. The callback receives an array of `{ address: '1.2.3.4', ttl: 60 }` objects rather than an array of strings. The TTL is expressed in seconds. * `callback` {Function} An `(err, result)` callback function. @@ -221,9 +221,9 @@ Uses the DNS protocol to resolve a IPv6 addresses (`AAAA` records) for the `hostname`. The `addresses` argument passed to the `callback` function will contain an array of IPv6 addresses. -* `hostname` {String} Hostname to resolve. +* `hostname` {string} Hostname to resolve. * `options` {Object} - * `ttl` {Boolean} Retrieve the Time-To-Live value (TTL) of each record. + * `ttl` {boolean} Retrieve the Time-To-Live value (TTL) of each record. The callback receives an array of `{ address: '0:1:2:3:4:5:6:7', ttl: 60 }` objects rather than an array of strings. The TTL is expressed in seconds. * `callback` {Function} An `(err, result)` callback function. diff --git a/doc/api/errors.md b/doc/api/errors.md index ea60f2b0e51ddb..94c06541c64842 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -196,7 +196,7 @@ will either be instances of, or inherit from, the `Error` class. ### new Error(message) -* `message` {String} +* `message` {string} Creates a new `Error` object and sets the `error.message` property to the provided text message. If an object is passed as `message`, the text message diff --git a/doc/api/events.md b/doc/api/events.md index 8864e78d9fc4c7..7462902e09479a 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -185,7 +185,7 @@ added and `'removeListener'` when existing listeners are removed. added: v0.1.26 --> -* `eventName` {String|Symbol} The name of the event being listened for +* `eventName` {string|symbol} The name of the event being listened for * `listener` {Function} The event handler function The `EventEmitter` instance will emit its own `'newListener'` event *before* @@ -224,7 +224,7 @@ myEmitter.emit('event'); added: v0.9.3 --> -* `eventName` {String|Symbol} The event name +* `eventName` {string|symbol} The event name * `listener` {Function} The event handler function The `'removeListener'` event is emitted *after* the `listener` is removed. @@ -339,7 +339,7 @@ set by [`emitter.setMaxListeners(n)`][] or defaults to added: v3.2.0 --> -* `eventName` {String|Symbol} The name of the event being listened for +* `eventName` {string|symbol} The name of the event being listened for Returns the number of listeners listening to the event named `eventName`. @@ -363,7 +363,7 @@ console.log(util.inspect(server.listeners('connection'))); added: v0.1.101 --> -* `eventName` {String|Symbol} The name of the event. +* `eventName` {string|symbol} The name of the event. * `listener` {Function} The callback function Adds the `listener` function to the end of the listeners array for the @@ -399,7 +399,7 @@ myEE.emit('foo'); added: v0.3.0 --> -* `eventName` {String|Symbol} The name of the event. +* `eventName` {string|symbol} The name of the event. * `listener` {Function} The callback function Adds a **one time** `listener` function for the event named `eventName`. The @@ -432,7 +432,7 @@ myEE.emit('foo'); added: v6.0.0 --> -* `eventName` {String|Symbol} The name of the event. +* `eventName` {string|symbol} The name of the event. * `listener` {Function} The callback function Adds the `listener` function to the *beginning* of the listeners array for the @@ -454,7 +454,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. added: v6.0.0 --> -* `eventName` {String|Symbol} The name of the event. +* `eventName` {string|symbol} The name of the event. * `listener` {Function} The callback function Adds a **one time** `listener` function for the event named `eventName` to the diff --git a/doc/api/fs.md b/doc/api/fs.md index 3594b3812e6b62..9ee03b2a2fec1d 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -121,8 +121,8 @@ The object itself emits these events: added: v0.5.8 --> -* `eventType` {String} The type of fs change -* `filename` {String | Buffer} The filename that changed (if relevant/available) +* `eventType` {string} The type of fs change +* `filename` {string | Buffer} The filename that changed (if relevant/available) Emitted when something changes in a watched directory or file. See more details in [`fs.watch()`][]. @@ -317,7 +317,7 @@ argument to `fs.createWriteStream()`. If `path` is passed as a string, then added: v0.11.15 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `mode` {Integer} * `callback` {Function} @@ -438,7 +438,7 @@ process. added: v0.11.15 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `mode` {Integer} Synchronous version of [`fs.access()`][]. This throws if any accessibility @@ -449,12 +449,12 @@ checks fail, and does nothing otherwise. added: v0.6.7 --> -* `file` {String | Buffer | Number} filename or file descriptor -* `data` {String | Buffer} +* `file` {string | Buffer | Number} filename or file descriptor +* `data` {string | Buffer} * `options` {Object | String} - * `encoding` {String | Null} default = `'utf8'` + * `encoding` {string | Null} default = `'utf8'` * `mode` {Integer} default = `0o666` - * `flag` {String} default = `'a'` + * `flag` {string} default = `'a'` * `callback` {Function} Asynchronously append data to a file, creating the file if it does not yet exist. @@ -485,12 +485,12 @@ automatically._ added: v0.6.7 --> -* `file` {String | Buffer | Number} filename or file descriptor -* `data` {String | Buffer} +* `file` {string | Buffer | Number} filename or file descriptor +* `data` {string | Buffer} * `options` {Object | String} - * `encoding` {String | Null} default = `'utf8'` + * `encoding` {string | Null} default = `'utf8'` * `mode` {Integer} default = `0o666` - * `flag` {String} default = `'a'` + * `flag` {string} default = `'a'` The synchronous version of [`fs.appendFile()`][]. Returns `undefined`. @@ -499,7 +499,7 @@ The synchronous version of [`fs.appendFile()`][]. Returns `undefined`. added: v0.1.30 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `mode` {Integer} * `callback` {Function} @@ -511,7 +511,7 @@ to the completion callback. added: v0.6.7 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `mode` {Integer} Synchronous chmod(2). Returns `undefined`. @@ -521,7 +521,7 @@ Synchronous chmod(2). Returns `undefined`. added: v0.1.97 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `uid` {Integer} * `gid` {Integer} * `callback` {Function} @@ -534,7 +534,7 @@ to the completion callback. added: v0.1.97 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `uid` {Integer} * `gid` {Integer} @@ -571,13 +571,13 @@ operations. The specific constants currently defined are described in added: v0.1.31 --> -* `path` {String | Buffer} -* `options` {String | Object} - * `flags` {String} - * `encoding` {String} +* `path` {string | Buffer} +* `options` {string | Object} + * `flags` {string} + * `encoding` {string} * `fd` {Integer} * `mode` {Integer} - * `autoClose` {Boolean} + * `autoClose` {boolean} * `start` {Integer} * `end` {Integer} @@ -632,13 +632,13 @@ If `options` is a string, then it specifies the encoding. added: v0.1.31 --> -* `path` {String | Buffer} -* `options` {String | Object} - * `flags` {String} - * `defaultEncoding` {String} +* `path` {string | Buffer} +* `options` {string | Object} + * `flags` {string} + * `defaultEncoding` {string} * `fd` {Integer} * `mode` {Integer} - * `autoClose` {Boolean} + * `autoClose` {boolean} * `start` {Integer} Returns a new [`WriteStream`][] object. (See [Writable Stream][]). @@ -682,7 +682,7 @@ deprecated: v1.0.0 > Stability: 0 - Deprecated: Use [`fs.stat()`][] or [`fs.access()`][] instead. -* `path` {String | Buffer} +* `path` {string | Buffer} * `callback` {Function} Test whether or not the given path exists by checking with the file system. @@ -784,7 +784,7 @@ process. added: v0.1.21 --> -* `path` {String | Buffer} +* `path` {string | Buffer} Synchronous version of [`fs.exists()`][]. Returns `true` if the file exists, `false` otherwise. @@ -993,7 +993,7 @@ Synchronous version of [`fs.futimes()`][]. Returns `undefined`. deprecated: v0.4.7 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `mode` {Integer} * `callback` {Function} @@ -1007,7 +1007,7 @@ Only available on macOS. deprecated: v0.4.7 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `mode` {Integer} Synchronous lchmod(2). Returns `undefined`. @@ -1017,7 +1017,7 @@ Synchronous lchmod(2). Returns `undefined`. deprecated: v0.4.7 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `uid` {Integer} * `gid` {Integer} * `callback` {Function} @@ -1030,7 +1030,7 @@ to the completion callback. deprecated: v0.4.7 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `uid` {Integer} * `gid` {Integer} @@ -1041,8 +1041,8 @@ Synchronous lchown(2). Returns `undefined`. added: v0.1.31 --> -* `existingPath` {String | Buffer} -* `newPath` {String | Buffer} +* `existingPath` {string | Buffer} +* `newPath` {string | Buffer} * `callback` {Function} Asynchronous link(2). No arguments other than a possible exception are given to @@ -1053,8 +1053,8 @@ the completion callback. added: v0.1.31 --> -* `existingPath` {String | Buffer} -* `newPath` {String | Buffer} +* `existingPath` {string | Buffer} +* `newPath` {string | Buffer} Synchronous link(2). Returns `undefined`. @@ -1063,7 +1063,7 @@ Synchronous link(2). Returns `undefined`. added: v0.1.30 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `callback` {Function} Asynchronous lstat(2). The callback gets two arguments `(err, stats)` where @@ -1076,7 +1076,7 @@ not the file that it refers to. added: v0.1.30 --> -* `path` {String | Buffer} +* `path` {string | Buffer} Synchronous lstat(2). Returns an instance of [`fs.Stats`][]. @@ -1085,7 +1085,7 @@ Synchronous lstat(2). Returns an instance of [`fs.Stats`][]. added: v0.1.8 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `mode` {Integer} * `callback` {Function} @@ -1097,7 +1097,7 @@ to the completion callback. `mode` defaults to `0o777`. added: v0.1.21 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `mode` {Integer} Synchronous mkdir(2). Returns `undefined`. @@ -1107,9 +1107,9 @@ Synchronous mkdir(2). Returns `undefined`. added: v5.10.0 --> -* `prefix` {String} -* `options` {String | Object} - * `encoding` {String} default = `'utf8'` +* `prefix` {string} +* `options` {string | Object} + * `encoding` {string} default = `'utf8'` * `callback` {Function} Creates a unique temporary directory. @@ -1169,9 +1169,9 @@ fs.mkdtemp(`${tmpDir}${sep}`, (err, folder) => { added: v5.10.0 --> -* `prefix` {String} -* `options` {String | Object} - * `encoding` {String} default = `'utf8'` +* `prefix` {string} +* `options` {string | Object} + * `encoding` {string} default = `'utf8'` The synchronous version of [`fs.mkdtemp()`][]. Returns the created folder path. @@ -1184,8 +1184,8 @@ object with an `encoding` property specifying the character encoding to use. added: v0.0.2 --> -* `path` {String | Buffer} -* `flags` {String | Number} +* `path` {string | Buffer} +* `flags` {string | Number} * `mode` {Integer} * `callback` {Function} @@ -1268,8 +1268,8 @@ fs.open('', 'a+', (err, fd) => { added: v0.1.21 --> -* `path` {String | Buffer} -* `flags` {String | Number} +* `path` {string | Buffer} +* `flags` {string | Number} * `mode` {Integer} Synchronous version of [`fs.open()`][]. Returns an integer representing the file @@ -1281,7 +1281,7 @@ added: v0.0.2 --> * `fd` {Integer} -* `buffer` {String | Buffer} +* `buffer` {string | Buffer} * `offset` {Integer} * `length` {Integer} * `position` {Integer} @@ -1305,9 +1305,9 @@ The callback is given the three arguments, `(err, bytesRead, buffer)`. added: v0.1.8 --> -* `path` {String | Buffer} -* `options` {String | Object} - * `encoding` {String} default = `'utf8'` +* `path` {string | Buffer} +* `options` {string | Object} + * `encoding` {string} default = `'utf8'` * `callback` {Function} Asynchronous readdir(3). Reads the contents of a directory. @@ -1324,9 +1324,9 @@ the filenames returned will be passed as `Buffer` objects. added: v0.1.21 --> -* `path` {String | Buffer} -* `options` {String | Object} - * `encoding` {String} default = `'utf8'` +* `path` {string | Buffer} +* `options` {string | Object} + * `encoding` {string} default = `'utf8'` Synchronous readdir(3). Returns an array of filenames excluding `'.'` and `'..'`. @@ -1341,10 +1341,10 @@ the filenames returned will be passed as `Buffer` objects. added: v0.1.29 --> -* `file` {String | Buffer | Integer} filename or file descriptor +* `file` {string | Buffer | Integer} filename or file descriptor * `options` {Object | String} - * `encoding` {String | Null} default = `null` - * `flag` {String} default = `'r'` + * `encoding` {string | Null} default = `null` + * `flag` {string} default = `'r'` * `callback` {Function} Asynchronously reads the entire contents of a file. Example: @@ -1377,10 +1377,10 @@ automatically._ added: v0.1.8 --> -* `file` {String | Buffer | Integer} filename or file descriptor +* `file` {string | Buffer | Integer} filename or file descriptor * `options` {Object | String} - * `encoding` {String | Null} default = `null` - * `flag` {String} default = `'r'` + * `encoding` {string | Null} default = `null` + * `flag` {string} default = `'r'` Synchronous version of [`fs.readFile`][]. Returns the contents of the `file`. @@ -1392,9 +1392,9 @@ string. Otherwise it returns a buffer. added: v0.1.31 --> -* `path` {String | Buffer} -* `options` {String | Object} - * `encoding` {String} default = `'utf8'` +* `path` {string | Buffer} +* `options` {string | Object} + * `encoding` {string} default = `'utf8'` * `callback` {Function} Asynchronous readlink(2). The callback gets two arguments `(err, @@ -1410,9 +1410,9 @@ the link path returned will be passed as a `Buffer` object. added: v0.1.31 --> -* `path` {String | Buffer} -* `options` {String | Object} - * `encoding` {String} default = `'utf8'` +* `path` {string | Buffer} +* `options` {string | Object} + * `encoding` {string} default = `'utf8'` Synchronous readlink(2). Returns the symbolic link's string value. @@ -1427,7 +1427,7 @@ added: v0.1.21 --> * `fd` {Integer} -* `buffer` {String | Buffer} +* `buffer` {string | Buffer} * `offset` {Integer} * `length` {Integer} * `position` {Integer} @@ -1439,9 +1439,9 @@ Synchronous version of [`fs.read()`][]. Returns the number of `bytesRead`. added: v0.1.31 --> -* `path` {String | Buffer} -* `options` {String | Object} - * `encoding` {String} default = `'utf8'` +* `path` {string | Buffer} +* `options` {string | Object} + * `encoding` {string} default = `'utf8'` * `callback` {Function} Asynchronous realpath(3). The `callback` gets two arguments `(err, @@ -1459,9 +1459,9 @@ the path returned will be passed as a `Buffer` object. added: v0.1.31 --> -* `path` {String | Buffer}; -* `options` {String | Object} - * `encoding` {String} default = `'utf8'` +* `path` {string | Buffer}; +* `options` {string | Object} + * `encoding` {string} default = `'utf8'` Synchronous realpath(3). Returns the resolved path. @@ -1477,8 +1477,8 @@ will be passed as a `Buffer` object. added: v0.0.2 --> -* `oldPath` {String | Buffer} -* `newPath` {String | Buffer} +* `oldPath` {string | Buffer} +* `newPath` {string | Buffer} * `callback` {Function} Asynchronous rename(2). No arguments other than a possible exception are given @@ -1489,8 +1489,8 @@ to the completion callback. added: v0.1.21 --> -* `oldPath` {String | Buffer} -* `newPath` {String | Buffer} +* `oldPath` {string | Buffer} +* `newPath` {string | Buffer} Synchronous rename(2). Returns `undefined`. @@ -1499,7 +1499,7 @@ Synchronous rename(2). Returns `undefined`. added: v0.0.2 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `callback` {Function} Asynchronous rmdir(2). No arguments other than a possible exception are given @@ -1510,7 +1510,7 @@ to the completion callback. added: v0.1.21 --> -* `path` {String | Buffer} +* `path` {string | Buffer} Synchronous rmdir(2). Returns `undefined`. @@ -1519,7 +1519,7 @@ Synchronous rmdir(2). Returns `undefined`. added: v0.0.2 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `callback` {Function} Asynchronous stat(2). The callback gets two arguments `(err, stats)` where @@ -1540,7 +1540,7 @@ is recommended. added: v0.1.21 --> -* `path` {String | Buffer} +* `path` {string | Buffer} Synchronous stat(2). Returns an instance of [`fs.Stats`][]. @@ -1549,9 +1549,9 @@ Synchronous stat(2). Returns an instance of [`fs.Stats`][]. added: v0.1.31 --> -* `target` {String | Buffer} -* `path` {String | Buffer} -* `type` {String} +* `target` {string | Buffer} +* `path` {string | Buffer} +* `type` {string} * `callback` {Function} Asynchronous symlink(2). No arguments other than a possible exception are given @@ -1574,9 +1574,9 @@ It creates a symbolic link named "new-port" that points to "foo". added: v0.1.31 --> -* `target` {String | Buffer} -* `path` {String | Buffer} -* `type` {String} +* `target` {string | Buffer} +* `path` {string | Buffer} +* `type` {string} Synchronous symlink(2). Returns `undefined`. @@ -1585,7 +1585,7 @@ Synchronous symlink(2). Returns `undefined`. added: v0.8.6 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `len` {Integer} default = `0` * `callback` {Function} @@ -1598,7 +1598,7 @@ first argument. In this case, `fs.ftruncate()` is called. added: v0.8.6 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `len` {Integer} default = `0` Synchronous truncate(2). Returns `undefined`. A file descriptor can also be @@ -1609,7 +1609,7 @@ passed as the first argument. In this case, `fs.ftruncateSync()` is called. added: v0.0.2 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `callback` {Function} Asynchronous unlink(2). No arguments other than a possible exception are given @@ -1620,7 +1620,7 @@ to the completion callback. added: v0.1.21 --> -* `path` {String | Buffer} +* `path` {string | Buffer} Synchronous unlink(2). Returns `undefined`. @@ -1629,7 +1629,7 @@ Synchronous unlink(2). Returns `undefined`. added: v0.1.31 --> -* `filename` {String | Buffer} +* `filename` {string | Buffer} * `listener` {Function} Stop watching for changes on `filename`. If `listener` is specified, only that @@ -1648,7 +1648,7 @@ when possible._ added: v0.4.2 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `atime` {Integer} * `mtime` {Integer} * `callback` {Function} @@ -1670,7 +1670,7 @@ follow these rules: added: v0.4.2 --> -* `path` {String | Buffer} +* `path` {string | Buffer} * `atime` {Integer} * `mtime` {Integer} @@ -1681,15 +1681,15 @@ Synchronous version of [`fs.utimes()`][]. Returns `undefined`. added: v0.5.10 --> -* `filename` {String | Buffer} -* `options` {String | Object} - * `persistent` {Boolean} Indicates whether the process should continue to run +* `filename` {string | Buffer} +* `options` {string | Object} + * `persistent` {boolean} Indicates whether the process should continue to run as long as files are being watched. default = `true` - * `recursive` {Boolean} Indicates whether all subdirectories should be + * `recursive` {boolean} Indicates whether all subdirectories should be watched, or only the current directory. The applies when a directory is specified, and only on supported platforms (See [Caveats][]). default = `false` - * `encoding` {String} Specifies the character encoding to be used for the + * `encoding` {string} Specifies the character encoding to be used for the filename passed to the listener. default = `'utf8'` * `listener` {Function} @@ -1784,9 +1784,9 @@ fs.watch('somedir', (eventType, filename) => { added: v0.1.31 --> -* `filename` {String | Buffer} +* `filename` {string | Buffer} * `options` {Object} - * `persistent` {Boolean} + * `persistent` {boolean} * `interval` {Integer} * `listener` {Function} @@ -1863,9 +1863,9 @@ added: v0.11.5 --> * `fd` {Integer} -* `data` {String | Buffer} +* `data` {string | Buffer} * `position` {Integer} -* `encoding` {String} +* `encoding` {string} * `callback` {Function} Write `data` to the file specified by `fd`. If `data` is not a Buffer instance @@ -1898,12 +1898,12 @@ the end of the file. added: v0.1.29 --> -* `file` {String | Buffer | Integer} filename or file descriptor -* `data` {String | Buffer} +* `file` {string | Buffer | Integer} filename or file descriptor +* `data` {string | Buffer} * `options` {Object | String} - * `encoding` {String | Null} default = `'utf8'` + * `encoding` {string | Null} default = `'utf8'` * `mode` {Integer} default = `0o666` - * `flag` {String} default = `'w'` + * `flag` {string} default = `'w'` * `callback` {Function} Asynchronously writes data to a file, replacing the file if it already exists. @@ -1941,12 +1941,12 @@ automatically._ added: v0.1.29 --> -* `file` {String | Buffer | Integer} filename or file descriptor -* `data` {String | Buffer} +* `file` {string | Buffer | Integer} filename or file descriptor +* `data` {string | Buffer} * `options` {Object | String} - * `encoding` {String | Null} default = `'utf8'` + * `encoding` {string | Null} default = `'utf8'` * `mode` {Integer} default = `0o666` - * `flag` {String} default = `'w'` + * `flag` {string} default = `'w'` The synchronous version of [`fs.writeFile()`][]. Returns `undefined`. @@ -1967,9 +1967,9 @@ added: v0.11.5 --> * `fd` {Integer} -* `data` {String | Buffer} +* `data` {string | Buffer} * `position` {Integer} -* `encoding` {String} +* `encoding` {string} Synchronous versions of [`fs.write()`][]. Returns the number of bytes written. diff --git a/doc/api/http.md b/doc/api/http.md index cdbdacb94c939e..3d7174e909fbdb 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -110,16 +110,16 @@ added: v0.3.4 * `options` {Object} Set of configurable options to set on the agent. Can have the following fields: - * `keepAlive` {Boolean} Keep sockets around even when there are no + * `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. Default = `false` * `keepAliveMsecs` {Integer} When using the `keepAlive` option, specifies the [initial delay](#net_socket_setkeepalive_enable_initialdelay) for TCP Keep-Alive packets. Ignored when the `keepAlive` option is `false` or `undefined`. Default = `1000`. - * `maxSockets` {Number} Maximum number of sockets to allow per + * `maxSockets` {number} Maximum number of sockets to allow per host. Default = `Infinity`. - * `maxFreeSockets` {Number} Maximum number of sockets to leave open + * `maxFreeSockets` {number} Maximum number of sockets to leave open in a free state. Only relevant if `keepAlive` is set to `true`. Default = `256`. @@ -184,9 +184,9 @@ 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 request to - * `port` {Number} Port of remote server - * `localAddress` {String} Local interface to bind for network connections + * `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 when issuing the request * Returns: {String} @@ -463,8 +463,8 @@ aborted, in milliseconds since 1 January 1970 00:00:00 UTC. added: v0.1.90 --> -* `data` {String | Buffer} -* `encoding` {String} +* `data` {string | Buffer} +* `encoding` {string} * `callback` {Function} Finishes sending the request. If any parts of the body are @@ -497,7 +497,7 @@ the optimization and kickstart the request. added: v0.5.9 --> -* `noDelay` {Boolean} +* `noDelay` {boolean} Once a socket is assigned to this request and is connected [`socket.setNoDelay()`][] will be called. @@ -507,8 +507,8 @@ Once a socket is assigned to this request and is connected added: v0.5.9 --> -* `enable` {Boolean} -* `initialDelay` {Number} +* `enable` {boolean} +* `initialDelay` {number} Once a socket is assigned to this request and is connected [`socket.setKeepAlive()`][] will be called. @@ -518,7 +518,7 @@ Once a socket is assigned to this request and is connected added: v0.5.9 --> -* `timeout` {Number} Milliseconds before a request is considered to be timed out. +* `timeout` {number} Milliseconds before a request is considered to be timed out. * `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 @@ -531,8 +531,8 @@ Returns `request`. added: v0.1.29 --> -* `chunk` {String | Buffer} -* `encoding` {String} +* `chunk` {string | Buffer} +* `encoding` {string} * `callback` {Function} Sends a chunk of the body. By calling this method @@ -731,7 +731,7 @@ subsequent call will *re-open* the server using the provided options. added: v0.1.90 --> -* `path` {String} +* `path` {string} * `callback` {Function} Start a UNIX socket server listening for connections on the given `path`. @@ -747,9 +747,9 @@ subsequent call will *re-open* the server using the provided options. added: v0.1.90 --> -* `port` {Number} -* `hostname` {String} -* `backlog` {Number} +* `port` {number} +* `hostname` {string} +* `backlog` {number} * `callback` {Function} Begin accepting connections on the specified `port` and `hostname`. If the @@ -797,7 +797,7 @@ no limit will be applied. added: v0.9.12 --> -* `msecs` {Number} +* `msecs` {number} * `callback` {Function} Sets the timeout value for sockets, and emits a `'timeout'` event on @@ -895,8 +895,8 @@ will result in a [`TypeError`][] being thrown. added: v0.1.90 --> -* `data` {String | Buffer} -* `encoding` {String} +* `data` {string | Buffer} +* `encoding` {string} * `callback` {Function} This method signals to the server that all of the response headers and body @@ -924,7 +924,7 @@ as `false`. After [`response.end()`][] executes, the value will be `true`. added: v0.4.0 --> -* `name` {String} +* `name` {string} * Returns: {String} Reads out a header that's already been queued but not sent to the client. @@ -950,7 +950,7 @@ Boolean (read-only). True if headers were sent, false otherwise. added: v0.4.0 --> -* `name` {String} +* `name` {string} Removes a header that's queued for implicit sending. @@ -978,8 +978,8 @@ in responses. added: v0.4.0 --> -* `name` {String} -* `value` {String} +* `name` {string} +* `value` {string} Sets a single header value for implicit headers. If this header already exists in the to-be-sent headers, its value will be replaced. Use an array of strings @@ -1019,7 +1019,7 @@ const server = http.createServer((req,res) => { added: v0.9.12 --> -* `msecs` {Number} +* `msecs` {number} * `callback` {Function} Sets the Socket's timeout value to `msecs`. If a callback is @@ -1080,8 +1080,8 @@ status message which was sent out. added: v0.1.29 --> -* `chunk` {String | Buffer} -* `encoding` {String} +* `chunk` {string | Buffer} +* `encoding` {string} * `callback` {Function} * Returns: {Boolean} @@ -1126,8 +1126,8 @@ the request body should be sent. See the [`'checkContinue'`][] event on `Server` added: v0.1.30 --> -* `statusCode` {Number} -* `statusMessage` {String} +* `statusCode` {number} +* `statusMessage` {string} * `headers` {Object} Sends a response header to the request. The status code is a 3-digit HTTP @@ -1315,7 +1315,7 @@ received. Only populated at the `'end'` event. added: v0.5.9 --> -* `msecs` {Number} +* `msecs` {number} * `callback` {Function} Calls `message.connection.setTimeout(msecs, callback)`. @@ -1533,28 +1533,28 @@ added: v0.3.6 --> * `options` {Object} - * `protocol` {String} Protocol to use. Defaults to `'http:'`. - * `host` {String} A domain name or IP address of the server to issue the + * `protocol` {string} Protocol to use. Defaults to `'http:'`. + * `host` {string} A domain name or IP address of the server to issue the request to. Defaults to `'localhost'`. - * `hostname` {String} Alias for `host`. To support [`url.parse()`][], + * `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 + * `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. - * `localAddress` {String} Local interface to bind for network connections. - * `socketPath` {String} Unix Domain Socket (use one of host:port or + * `port` {number} Port of remote server. Defaults to 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. Defaults to `'GET'`. - * `path` {String} Request path. Defaults to `'/'`. Should include query + * `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. * `headers` {Object} An object containing request headers. - * `auth` {String} Basic authentication i.e. `'user:password'` to compute an + * `auth` {string} Basic authentication i.e. `'user:password'` to compute an Authorization header. - * `agent` {http.Agent|Boolean} Controls [`Agent`][] behavior. Possible values: + * `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`. * `false`: causes a new `Agent` with default values to be used. diff --git a/doc/api/modules.md b/doc/api/modules.md index cdbbf14fa43310..4eca72dd210c55 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -624,7 +624,7 @@ The module that first required this one. added: v0.5.1 --> -* `id` {String} +* `id` {string} * Returns: {Object} `module.exports` from the resolved module The `module.require` method provides a way to load a module as if diff --git a/doc/api/net.md b/doc/api/net.md index d7219efe5b3548..e6bbb05b0e2c61 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -123,7 +123,7 @@ added: v0.5.10 --> * `handle` {Object} -* `backlog` {Number} +* `backlog` {number} * `callback` {Function} The `handle` object can be set to either a server or socket (anything @@ -149,11 +149,11 @@ added: v0.11.14 --> * `options` {Object} - Required. Supports the following properties: - * `port` {Number} - Optional. - * `host` {String} - Optional. - * `backlog` {Number} - Optional. - * `path` {String} - Optional. - * `exclusive` {Boolean} - Optional. + * `port` {number} - Optional. + * `host` {string} - Optional. + * `backlog` {number} - Optional. + * `path` {string} - Optional. + * `exclusive` {boolean} - Optional. * `callback` {Function} - Optional. The `port`, `host`, and `backlog` properties of `options`, as well as the @@ -183,8 +183,8 @@ subsequent call will *re-open* the server using the provided options. added: v0.1.90 --> -* `path` {String} -* `backlog` {Number} +* `path` {string} +* `backlog` {number} * `callback` {Function} Start a local socket server listening for connections on the given `path`. @@ -343,7 +343,7 @@ About `allowHalfOpen`, refer to [`net.createServer()`][] and [`'end'`][] event. added: v0.1.90 --> -* `had_error` {Boolean} `true` if the socket had a transmission error. +* `had_error` {boolean} `true` if the socket had a transmission error. Emitted once the socket is fully closed. The argument `had_error` is a boolean which says if the socket was closed due to a transmission error. @@ -410,10 +410,10 @@ added: v0.11.3 Emitted after resolving the hostname but before connecting. Not applicable to UNIX sockets. -* `err` {Error|Null} The error object. See [`dns.lookup()`][]. -* `address` {String} The IP address. -* `family` {String|Null} The address type. See [`dns.lookup()`][]. -* `host` {String} The hostname. +* `err` {Error|null} The error object. See [`dns.lookup()`][]. +* `address` {string} The IP address. +* `family` {string|null} The address type. See [`dns.lookup()`][]. +* `host` {string} The hostname. ### Event: 'timeout' * `options` {Object} - * `encoding` {String} Character encoding used to interpret resulting strings. + * `encoding` {string} Character encoding used to interpret resulting strings. If `encoding` is set to `'buffer'`, the `username`, `shell`, and `homedir` values will be `Buffer` instances. (Default: 'utf8') * Returns: {Object} diff --git a/doc/api/path.md b/doc/api/path.md index 0c78c916497f6c..c8fdff46a76d5f 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -59,8 +59,8 @@ path.posix.basename('/tmp/myfile.html'); added: v0.1.25 --> -* `path` {String} -* `ext` {String} An optional file extension +* `path` {string} +* `ext` {string} An optional file extension * Returns: {String} The `path.basename()` methods returns the last portion of a `path`, similar to @@ -117,7 +117,7 @@ process.env.PATH.split(path.delimiter) added: v0.1.16 --> -* `path` {String} +* `path` {string} * Returns: {String} The `path.dirname()` method returns the directory name of a `path`, similar to @@ -138,7 +138,7 @@ A [`TypeError`][] is thrown if `path` is not a string. added: v0.1.25 --> -* `path` {String} +* `path` {string} * Returns: {String} The `path.extname()` method returns the extension of the `path`, from the last @@ -174,11 +174,11 @@ added: v0.11.15 --> * `pathObject` {Object} - * `dir` {String} - * `root` {String} - * `base` {String} - * `name` {String} - * `ext` {String} + * `dir` {string} + * `root` {string} + * `base` {string} + * `name` {string} + * `ext` {string} * Returns: {String} The `path.format()` method returns a path string from an object. This is the @@ -237,7 +237,7 @@ path.format({ added: v0.11.2 --> -* `path` {String} +* `path` {string} * Returns: {Boolean} The `path.isAbsolute()` method determines if `path` is an absolute path. @@ -272,7 +272,7 @@ A [`TypeError`][] is thrown if `path` is not a string. added: v0.1.16 --> -* `...paths` {String} A sequence of path segments +* `...paths` {string} A sequence of path segments * Returns: {String} The `path.join()` method joins all given `path` segments together using the @@ -299,7 +299,7 @@ A [`TypeError`][] is thrown if any of the path segments is not a string. added: v0.1.23 --> -* `path` {String} +* `path` {string} * Returns: {String} The `path.normalize()` method normalizes the given `path`, resolving `'..'` and @@ -333,7 +333,7 @@ A [`TypeError`][] is thrown if `path` is not a string. added: v0.11.15 --> -* `path` {String} +* `path` {string} * Returns: {Object} The `path.parse()` method returns an object whose properties represent @@ -342,11 +342,11 @@ see [`path.sep`][]. The returned object will have the following properties: -* `root` {String} -* `dir` {String} -* `base` {String} -* `ext` {String} -* `name` {String} +* `root` {string} +* `dir` {string} +* `base` {string} +* `ext` {string} +* `name` {string} For example on POSIX: @@ -413,8 +413,8 @@ of the `path` methods. added: v0.5.0 --> -* `from` {String} -* `to` {String} +* `from` {string} +* `to` {string} * Returns: {String} The `path.relative()` method returns the relative path from `from` to `to`. @@ -445,7 +445,7 @@ A [`TypeError`][] is thrown if neither `from` nor `to` is a string. added: v0.3.4 --> -* `...paths` {String} A sequence of paths or path segments +* `...paths` {string} A sequence of paths or path segments * Returns: {String} The `path.resolve()` method resolves a sequence of paths or path segments into diff --git a/doc/api/process.md b/doc/api/process.md index 5d4c08f1438189..6a1a779ddddf9d 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -268,9 +268,9 @@ lead to sub-optimal application performance, bugs or security vulnerabilities. The listener function is called with a single `warning` argument whose value is an `Error` object. There are three key properties that describe the warning: -* `name` {String} The name of the warning (currently `Warning` by default). -* `message` {String} A system-provided description of the warning. -* `stack` {String} A stack trace to the location in the code where the warning +* `name` {string} The name of the warning (currently `Warning` by default). +* `message` {string} A system-provided description of the warning. +* `stack` {string} A stack trace to the location in the code where the warning was issued. ```js @@ -519,7 +519,7 @@ $ bash -c 'exec -a customArgv0 ./node' added: v0.1.17 --> -* `directory` {String} +* `directory` {string} The `process.chdir()` method changes the current working directory of the Node.js process or throws an exception if doing so fails (for instance, if @@ -740,8 +740,8 @@ console.log(process.env.test); added: v6.0.0 --> -* `warning` {String | Error} The warning to emit. -* `name` {String} When `warning` is a String, `name` is the name to use +* `warning` {string | Error} The warning to emit. +* `name` {string} When `warning` is a String, `name` is the name to use for the warning. Default: `Warning`. * `ctor` {Function} When `warning` is a String, `ctor` is an optional function used to limit the generated stack trace. Default @@ -1080,8 +1080,8 @@ passing the result to process.hrtime() will result in undefined behavior. added: v0.9.4 --> -* `user` {String|number} The user name or numeric identifier. -* `extra_group` {String|number} A group name or numeric identifier. +* `user` {string|number} The user name or numeric identifier. +* `extra_group` {string|number} A group name or numeric identifier. The `process.initgroups()` method reads the `/etc/group` file and initializes the group access list, using all groups of which the user is a member. This is @@ -1107,7 +1107,7 @@ added: v0.0.6 --> * `pid` {number} A process ID -* `signal` {String|number} The signal to send, either as a string or number. +* `signal` {string|number} The signal to send, either as a string or number. Defaults to `'SIGTERM'`. The `process.kill()` method sends the `signal` to the process identified by @@ -1325,7 +1325,7 @@ tarball. `process.release` contains the following properties: -* `name` {String} A value that will always be `'node'` for Node.js. For +* `name` {string} A value that will always be `'node'` for Node.js. For legacy io.js releases, this will be `'io.js'`. * `lts`: a string with a value indicating the _codename_ of the LTS (Long-term Support) line the current release is part of. This property only exists for @@ -1333,17 +1333,17 @@ tarball. releases. Current valid values are: - `"Argon"` for the v4.x LTS line beginning with v4.2.0. - `"Boron"` for the v6.x LTS line beginning with v6.9.0. -* `sourceUrl` {String} an absolute URL pointing to a _`.tar.gz`_ file containing +* `sourceUrl` {string} an absolute URL pointing to a _`.tar.gz`_ file containing the source code of the current release. * `headersUrl`{String} an absolute URL pointing to a _`.tar.gz`_ file containing only the source header files for the current release. This file is significantly smaller than the full source file and can be used for compiling Node.js native add-ons. -* `libUrl` {String} an absolute URL pointing to a _`node.lib`_ file matching the +* `libUrl` {string} an absolute URL pointing to a _`node.lib`_ file matching the architecture and version of the current release. This file is used for compiling Node.js native add-ons. _This property is only present on Windows builds of Node.js and will be missing on all other platforms._ -* `lts` {String} a string label identifying the [LTS][] label for this release. +* `lts` {string} a string label identifying the [LTS][] label for this release. If the Node.js release is not an LTS release, this will be `undefined`. For example: @@ -1388,7 +1388,7 @@ If Node.js was not spawned with an IPC channel, `process.send()` will be added: v2.0.0 --> -* `id` {String|number} A group name or ID +* `id` {string|number} A group name or ID The `process.setegid()` method sets the effective group identity of the process. (See setegid(2).) The `id` can be passed as either a numeric ID or a group @@ -1417,7 +1417,7 @@ Android) added: v2.0.0 --> -* `id` {String|number} A user name or ID +* `id` {string|number} A user name or ID The `process.seteuid()` method sets the effective user identity of the process. (See seteuid(2).) The `id` can be passed as either a numeric ID or a username @@ -1445,7 +1445,7 @@ Android) added: v0.1.31 --> -* `id` {String|number} The group name or ID +* `id` {string|number} The group name or ID The `process.setgid()` method sets the group identity of the process. (See setgid(2).) The `id` can be passed as either a numeric ID or a group name diff --git a/doc/api/punycode.md b/doc/api/punycode.md index a5d1908a8c40b6..87d1c7d80ad431 100644 --- a/doc/api/punycode.md +++ b/doc/api/punycode.md @@ -34,7 +34,7 @@ the module must be directed to the [Punycode.js][] project. added: v0.5.1 --> -* `string` {String} +* `string` {string} The `punycode.decode()` method converts a [Punycode][] string of ASCII-only characters to the equivalent string of Unicode codepoints. @@ -49,7 +49,7 @@ punycode.decode('--dqo34k'); // '☃-⌘' added: v0.5.1 --> -* `string` {String} +* `string` {string} The `punycode.encode()` method converts a string of Unicode codepoints to a [Punycode][] string of ASCII-only characters. @@ -64,7 +64,7 @@ punycode.encode('☃-⌘'); // '--dqo34k' added: v0.6.1 --> -* `domain` {String} +* `domain` {string} The `punycode.toASCII()` method converts a Unicode string representing an Internationalized Domain Name to [Punycode][]. Only the non-ASCII parts of the @@ -83,7 +83,7 @@ punycode.toASCII('example.com'); // 'example.com' added: v0.6.1 --> -* `domain` {String} +* `domain` {string} The `punycode.toUnicode()` method converts a string representing a domain name containing [Punycode][] encoded characters into Unicode. Only the [Punycode][] @@ -106,7 +106,7 @@ added: v0.7.0 added: v0.7.0 --> -* `string` {String} +* `string` {string} The `punycode.ucs2.decode()` method returns an array containing the numeric codepoint values of each Unicode symbol in the string. diff --git a/doc/api/querystring.md b/doc/api/querystring.md index 4dc6585397c063..a1ee5e62b87700 100644 --- a/doc/api/querystring.md +++ b/doc/api/querystring.md @@ -16,7 +16,7 @@ const querystring = require('querystring'); added: v0.1.25 --> -* `str` {String} +* `str` {string} The `querystring.escape()` method performs URL percent-encoding on the given `str` in a manner that is optimized for the specific requirements of URL @@ -32,10 +32,10 @@ necessary by assigning `querystring.escape` to an alternative function. added: v0.1.25 --> -* `str` {String} The URL query string to parse -* `sep` {String} The substring used to delimit key and value pairs in the +* `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 `'&'`. -* `eq` {String}. The substring used to delimit keys and values in the +* `eq` {string}. The substring used to delimit keys and values in the query string. Defaults to `'='`. * `options` {Object} * `decodeURIComponent` {Function} The function to use when decoding @@ -79,9 +79,9 @@ 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 +* `sep` {string} The substring used to delimit key and value pairs in the query string. Defaults to `'&'`. -* `eq` {String}. The substring used to delimit keys and values in the +* `eq` {string}. The substring used to delimit keys and values in the query string. Defaults to `'='`. * `options` * `encodeURIComponent` {Function} The function to use when converting @@ -121,7 +121,7 @@ querystring.stringify({ w: '中文', foo: 'bar' }, null, null, -* `str` {String} +* `str` {string} The `querystring.unescape()` method performs decoding of URL percent-encoded diff --git a/doc/api/readline.md b/doc/api/readline.md index acbb94c3e95edb..59055ec76e3485 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -237,7 +237,7 @@ If the `readline.Interface` was created with `output` set to `null` or added: v0.3.3 --> -* `query` {String} A statement or query to write to `output`, prepended to the +* `query` {string} A statement or query to write to `output`, prepended to the prompt. * `callback` {Function} A callback function that is invoked with the user's input in response to the `query`. @@ -276,7 +276,7 @@ The `rl.resume()` method resumes the `input` stream if it has been paused. added: v0.1.98 --> -* `prompt` {String} +* `prompt` {string} The `rl.setPrompt()` method sets the prompt that will be written to `output` whenever `rl.prompt()` is called. @@ -286,12 +286,12 @@ whenever `rl.prompt()` is called. added: v0.1.98 --> -* `data` {String} +* `data` {string} * `key` {Object} * `ctrl` {boolean} `true` to indicate the `` key. * `meta` {boolean} `true` to indicate the `` key. * `shift` {boolean} `true` to indicate the `` key. - * `name` {String} The name of the a key. + * `name` {string} The name of the a key. The `rl.write()` method will write either `data` or a key sequence identified by `key` to the `output`. The `key` argument is supported only if `output` is @@ -463,7 +463,7 @@ added: v0.7.7 * `stream` {Writable} * `dx` {number} -* `dy` {Number} +* `dy` {number} The `readline.moveCursor()` method moves the cursor *relative* to its current position in a given [TTY][] `stream`. diff --git a/doc/api/repl.md b/doc/api/repl.md index 9ff416e004f4b3..27b5b9aa392ab2 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -304,7 +304,7 @@ Clearing context... added: v0.3.0 --> -* `keyword` {String} The command keyword (*without* a leading `.` character). +* `keyword` {string} The command keyword (*without* a leading `.` character). * `cmd` {Object|Function} The function to invoke when the command is processed. The `replServer.defineCommand()` method is used to add new `.`-prefixed commands @@ -312,7 +312,7 @@ to the REPL instance. Such commands are invoked by typing a `.` followed by the `keyword`. The `cmd` is either a Function or an object with the following properties: -* `help` {String} Help text to be displayed when `.help` is entered (Optional). +* `help` {string} Help text to be displayed when `.help` is entered (Optional). * `action` {Function} The function to execute, optionally accepting a single string argument. @@ -351,7 +351,7 @@ Goodbye! added: v0.1.91 --> -* `preserveCursor` {Boolean} +* `preserveCursor` {boolean} The `replServer.displayPrompt()` method readies the REPL instance for input from the user, printing the configured `prompt` to a new line in the `output` @@ -372,7 +372,7 @@ added: v0.1.91 --> * `options` {Object | String} - * `prompt` {String} The input prompt to display. Defaults to `> `. + * `prompt` {string} The input prompt to display. Defaults to `> `. * `input` {Readable} The Readable stream from which REPL input will be read. Defaults to `process.stdin`. * `output` {Writable} The Writable stream to which REPL output will be diff --git a/doc/api/stream.md b/doc/api/stream.md index 35755185eb9c4e..e74cb327ce0239 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -354,10 +354,10 @@ See also: [`writable.uncork()`][]. added: v0.9.4 --> -* `chunk` {String|Buffer|any} Optional data to write. For streams not operating +* `chunk` {string|Buffer|any} Optional data to write. For streams not operating in object mode, `chunk` must be a string or a `Buffer`. For object mode streams, `chunk` may be any JavaScript value other than `null`. -* `encoding` {String} The encoding, if `chunk` is a String +* `encoding` {string} The encoding, if `chunk` is a String * `callback` {Function} Optional callback for when the stream is finished Calling the `writable.end()` method signals that no more data will be written @@ -382,7 +382,7 @@ file.end('world!'); added: v0.11.15 --> -* `encoding` {String} The new default encoding +* `encoding` {string} The new default encoding * Returns: `this` The `writable.setDefaultEncoding()` method sets the default `encoding` for a @@ -431,8 +431,8 @@ See also: [`writable.cork()`][]. added: v0.9.4 --> -* `chunk` {String|Buffer} The data to write -* `encoding` {String} The encoding, if `chunk` is a String +* `chunk` {string|Buffer} The data to write +* `encoding` {string} The encoding, if `chunk` is a String * `callback` {Function} Callback for when this chunk of data is flushed * Returns: {Boolean} `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write @@ -616,7 +616,7 @@ Not all [Readable][] streams will emit the `'close'` event. added: v0.9.4 --> -* `chunk` {Buffer|String|any} The chunk of data. For streams that are not +* `chunk` {Buffer|string|any} The chunk of data. For streams that are not operating in object mode, the chunk will be either a string or `Buffer`. For streams that are in object mode, the chunk can be any JavaScript value other than `null`. @@ -780,7 +780,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. Defaults to `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 @@ -836,8 +836,8 @@ options. added: v0.9.4 --> -* `size` {Number} Optional argument to specify how much data to read. -* Return {String|Buffer|Null} +* `size` {number} Optional argument to specify how much data to read. +* Return {String|Buffer|null} The `readable.read()` method pulls some data out of the internal buffer and returns it. If no data available to be read, `null` is returned. By default, @@ -908,7 +908,7 @@ getReadableStreamSomehow() added: v0.9.4 --> -* `encoding` {String} The encoding to use. +* `encoding` {string} The encoding to use. * Returns: `this` The `readable.setEncoding()` method sets the default character encoding for @@ -972,7 +972,7 @@ setTimeout(() => { added: v0.9.11 --> -* `chunk` {Buffer|String} Chunk of data to unshift onto the read queue +* `chunk` {Buffer|string} Chunk of data to unshift onto the read queue The `readable.unshift()` method pushes a chunk of data back into the internal buffer. This is useful in certain situations where a stream is being consumed by @@ -1219,13 +1219,13 @@ constructor and implement the `writable._write()` method. The #### Constructor: new stream.Writable([options]) * `options` {Object} - * `highWaterMark` {Number} Buffer level when + * `highWaterMark` {number} Buffer level when [`stream.write()`][stream-write] starts returning `false`. Defaults to `16384` (16kb), or `16` for `objectMode` streams. - * `decodeStrings` {Boolean} Whether or not to decode strings into + * `decodeStrings` {boolean} Whether or not to decode strings into Buffers before passing them to [`stream._write()`][stream-_write]. Defaults to `true` - * `objectMode` {Boolean} Whether or not the + * `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 or `Buffer` if supported by the stream implementation. Defaults to `false` @@ -1278,9 +1278,9 @@ const myWritable = new Writable({ #### writable.\_write(chunk, encoding, callback) -* `chunk` {Buffer|String} The chunk to be written. Will **always** +* `chunk` {Buffer|string} The chunk to be written. Will **always** be a buffer unless the `decodeStrings` option was set to `false`. -* `encoding` {String} If the chunk is a string, then `encoding` is the +* `encoding` {string} If the chunk is a string, then `encoding` is the character encoding of that string. If chunk is a `Buffer`, or if the stream is operating in object mode, `encoding` may be ignored. * `callback` {Function} Call this function (optionally with an error @@ -1400,12 +1400,12 @@ constructor and implement the `readable._read()` method. #### new stream.Readable([options]) * `options` {Object} - * `highWaterMark` {Number} The maximum number of bytes to store in + * `highWaterMark` {number} The maximum number of bytes to store in the internal buffer before ceasing to read from the underlying resource. Defaults to `16384` (16kb), or `16` for `objectMode` streams - * `encoding` {String} If specified, then buffers will be decoded to + * `encoding` {string} If specified, then buffers will be decoded to strings using the specified encoding. Defaults to `null` - * `objectMode` {Boolean} Whether this stream should behave + * `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` * `read` {Function} Implementation for the [`stream._read()`][stream-_read] @@ -1452,7 +1452,7 @@ const myReadable = new Readable({ #### readable.\_read(size) -* `size` {Number} Number of bytes to read asynchronously +* `size` {number} Number of bytes to read asynchronously *Note*: **This function MUST NOT be called by application code directly.** It should be implemented by child classes, and called only by the internal Readable @@ -1483,8 +1483,8 @@ user programs. #### readable.push(chunk[, encoding]) -* `chunk` {Buffer|Null|String} Chunk of data to push into the read queue -* `encoding` {String} Encoding of String chunks. Must be a valid +* `chunk` {Buffer|null|string} Chunk of data to push into the read queue +* `encoding` {string} Encoding of String chunks. Must be a valid Buffer encoding, such as `'utf8'` or `'ascii'` * Returns {Boolean} `true` if additional chunks of data may continued to be pushed; `false` otherwise. @@ -1615,13 +1615,13 @@ constructor and implement *both* the `readable._read()` and * `options` {Object} Passed to both Writable and Readable constructors. Also has the following fields: - * `allowHalfOpen` {Boolean} Defaults to `true`. If set to `false`, then + * `allowHalfOpen` {boolean} Defaults to `true`. If set to `false`, then the stream will automatically end the readable side when the writable side ends and vice versa. - * `readableObjectMode` {Boolean} Defaults to `false`. Sets `objectMode` + * `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` + * `writableObjectMode` {boolean} Defaults to `false`. Sets `objectMode` for writable side of the stream. Has no effect if `objectMode` is `true`. @@ -1857,9 +1857,9 @@ user programs. #### transform.\_transform(chunk, encoding, callback) -* `chunk` {Buffer|String} The chunk to be transformed. Will **always** +* `chunk` {Buffer|string} The chunk to be transformed. Will **always** be a buffer unless the `decodeStrings` option was set to `false`. -* `encoding` {String} If the chunk is a string, then this is the +* `encoding` {string} If the chunk is a string, then this is the encoding type. If chunk is a buffer, then this is the special value - 'buffer', ignore it in this case. * `callback` {Function} A callback function (optionally with an error diff --git a/doc/api/url.md b/doc/api/url.md index 40a3440195e69a..ce47a2b695af0e 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -136,7 +136,7 @@ For example: `'#hash'` added: v0.1.25 --> -* `urlObject` {Object | String} A URL object (as returned by `url.parse()` or +* `urlObject` {Object | string} A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`. @@ -198,18 +198,59 @@ The formatting process operates as follows: string, an [`Error`][] is thrown. * `result` is returned. +## url.format(URL[, options]) + +> Stability: 1 - Experimental + +* `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`. + * `fragment` {boolean} `true` if the serialized URL string should include the + fragment, `false` otherwise. Defaults to `true`. + * `search` {boolean} `true` if the serialized URL string should include the + search query, `false` otherwise. Defaults to `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`. + +Returns a customizable serialization of a URL String representation of a +[WHATWG URL][] object. + +The URL object has both a `toString()` method and `href` property that return +string serializations of the URL. These are not, however, customizable in +any way. The `url.format(URL[, options])` method allows for basic customization +of the output. + +For example: + +```js +const myURL = new URL('https://a:b@你好你好?abc#foo'); + +console.log(myURL.href); + // Prints https://a:b@xn--6qqa088eba/?abc#foo + +console.log(myURL.toString()); + // Prints https://a:b@xn--6qqa088eba/?abc#foo + +console.log(url.format(myURL, {fragment: false, unicode: true, auth: false})); + // Prints 'https://你好你好?abc' +``` + +*Note*: This variation of the `url.format()` method is currently considered to +be experimental. ## url.parse(urlString[, parseQueryString[, slashesDenoteHost]]) -* `urlString` {String} The URL string to parse. -* `parseQueryString` {Boolean} If `true`, the `query` property will always +* `urlString` {string} The URL string to parse. +* `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`. -* `slashesDenoteHost` {Boolean} If `true`, the first token after the literal +* `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'}`. @@ -223,8 +264,8 @@ object. added: v0.1.25 --> -* `from` {String} The Base URL being resolved against. -* `to` {String} The HREF URL being resolved. +* `from` {string} The Base URL being resolved against. +* `to` {string} The HREF URL being resolved. The `url.resolve()` method resolves a target URL relative to a base URL in a manner similar to that of a Web browser resolving an anchor tag HREF. @@ -250,7 +291,6 @@ properties of URL objects: For example, the ASCII space character (`' '`) is encoded as `%20`. The ASCII forward slash (`/`) character is encoded as `%3C`. - [`Error`]: errors.html#errors_class_error [`querystring`]: querystring.html [`TypeError`]: errors.html#errors_class_typeerror diff --git a/doc/api/util.md b/doc/api/util.md index 28ceac1c54d7a9..01a653250c01da 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -15,7 +15,7 @@ const util = require('util'); added: v0.11.3 --> -* `section` {String} A string identifying the portion of the application for +* `section` {string} A string identifying the portion of the application for which the `debuglog` function is being created. * Returns: {Function} The logging function @@ -93,7 +93,7 @@ property take precedence over `--trace-deprecation` and added: v0.5.3 --> -* `format` {String} A `printf`-like format string. +* `format` {string} A `printf`-like format string. The `util.format()` method returns a formatted string using the first argument as a `printf`-like format. @@ -391,7 +391,7 @@ deprecated: v0.11.3 > Stability: 0 - Deprecated: Use [`console.error()`][] instead. -* `string` {String} The message to print to `stderr` +* `string` {string} The message to print to `stderr` Deprecated predecessor of `console.error`. @@ -403,7 +403,7 @@ deprecated: v0.11.3 > Stability: 0 - Deprecated: Use [`console.error()`][] instead. -* `...strings` {String} The message to print to `stderr` +* `...strings` {string} The message to print to `stderr` Deprecated predecessor of `console.error`. @@ -805,7 +805,7 @@ deprecated: v6.0.0 > Stability: 0 - Deprecated: Use a third party module instead. -* `string` {String} +* `string` {string} The `util.log()` method prints the given `string` to `stdout` with an included timestamp. From 001351e43d02b620dfcd38d913ccd4b5a3bde7dc Mon Sep 17 00:00:00 2001 From: Roman Reiss Date: Tue, 14 Feb 2017 21:38:19 +0100 Subject: [PATCH 2/4] doc: linkify type[] syntax, support lowercase for primitives PR-URL: https://github.com/nodejs/node/pull/11167 Reviewed-By: Timothy Gu Reviewed-By: James M Snell Reviewed-By: Joyee Cheung --- tools/doc/type-parser.js | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js index 38451b0e16b358..99ce2dfe7beebc 100644 --- a/tools/doc/type-parser.js +++ b/tools/doc/type-parser.js @@ -5,12 +5,12 @@ const jsDocUrl = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/' + const jsPrimitiveUrl = 'https://developer.mozilla.org/en-US/docs/Web/' + 'JavaScript/Data_structures'; const jsPrimitives = { - 'Integer': 'Number', // this is for extending - 'Number': 'Number', - 'String': 'String', - 'Boolean': 'Boolean', - 'Null': 'Null', - 'Symbol': 'Symbol' + 'integer': 'Number', // this is for extending + 'number': 'Number', + 'string': 'String', + 'boolean': 'Boolean', + 'null': 'Null', + 'symbol': 'Symbol' }; const jsGlobalTypes = [ 'Error', 'Object', 'Function', 'Array', 'TypedArray', 'Uint8Array', @@ -49,7 +49,16 @@ module.exports = { typeText = typeText.trim(); if (typeText) { let typeUrl = null; - const primitive = jsPrimitives[typeText]; + + // To support type[], we store the full string and use + // the bracket-less version to lookup the type URL + const typeTextFull = typeText; + if (/\[]$/.test(typeText)) { + typeText = typeText.slice(0, -2); + } + + const primitive = jsPrimitives[typeText.toLowerCase()]; + if (primitive !== undefined) { typeUrl = `${jsPrimitiveUrl}#${primitive}_type`; } else if (jsGlobalTypes.indexOf(typeText) !== -1) { @@ -60,9 +69,9 @@ module.exports = { if (typeUrl) { typeLinks.push('<' + - typeText + '>'); + typeTextFull + '>'); } else { - typeLinks.push('<' + typeText + '>'); + typeLinks.push('<' + typeTextFull + '>'); } } }); From 8098f492b8acee1c380b77a5f66baf030e32af17 Mon Sep 17 00:00:00 2001 From: Roman Reiss Date: Thu, 2 Mar 2017 18:32:47 +0100 Subject: [PATCH 3/4] tools: fix lint issue in doctool PR-URL: https://github.com/nodejs/node/pull/11658 Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- tools/doc/type-parser.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js index 99ce2dfe7beebc..96fdaf16e99461 100644 --- a/tools/doc/type-parser.js +++ b/tools/doc/type-parser.js @@ -71,7 +71,8 @@ module.exports = { typeLinks.push('<' + typeTextFull + '>'); } else { - typeLinks.push('<' + typeTextFull + '>'); + typeLinks.push('<' + typeTextFull + + '>'); } } }); From 6014aa753c7efc3ae28021ca63b38ba7f2a62fa6 Mon Sep 17 00:00:00 2001 From: Roman Reiss Date: Sun, 5 Mar 2017 18:03:39 +0100 Subject: [PATCH 4/4] doc/tools: fix more type inconsistencies - fix a number of uppercase types - lowercase 'integer' - consistent formatting in crypto PR-URL: https://github.com/nodejs/node/pull/11697 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Timothy Gu --- doc/api/assert.md | 2 +- doc/api/buffer.md | 204 +++++++++++------------ doc/api/child_process.md | 32 ++-- doc/api/cluster.md | 8 +- doc/api/console.md | 7 + doc/api/crypto.md | 20 +-- doc/api/dns.md | 4 +- doc/api/errors.md | 18 +- doc/api/fs.md | 348 ++++++++++++++++++++------------------- doc/api/globals.md | 4 +- doc/api/http.md | 8 +- doc/api/modules.md | 6 +- doc/api/os.md | 24 +-- doc/api/path.md | 22 +-- doc/api/process.md | 42 ++--- doc/api/repl.md | 2 +- doc/api/stream.md | 8 +- tools/doc/type-parser.js | 9 +- 18 files changed, 389 insertions(+), 379 deletions(-) diff --git a/doc/api/assert.md b/doc/api/assert.md index 873f03e77553b2..e02829918c8b45 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -199,7 +199,7 @@ added: v0.1.21 * `actual` {any} * `expected` {any} * `message` {any} -* `operator` {String} +* `operator` {string} Throws an `AssertionError`. If `message` is falsy, the error message is set as the values of `actual` and `expected` separated by the provided `operator`. diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 228dc4d22af46f..4b3f762f80740c 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -350,8 +350,8 @@ deprecated: v6.0.0 * `arrayBuffer` {ArrayBuffer} An [`ArrayBuffer`] or the `.buffer` property of a [`TypedArray`]. -* `byteOffset` {Integer} Index of first byte to expose. **Default:** `0` -* `length` {Integer} Number of bytes to expose. +* `byteOffset` {integer} Index of first byte to expose. **Default:** `0` +* `length` {integer} Number of bytes to expose. **Default:** `arrayBuffer.length - byteOffset` This creates a view of the [`ArrayBuffer`] without copying the underlying @@ -391,7 +391,7 @@ deprecated: v6.0.0 > Stability: 0 - Deprecated: Use [`Buffer.alloc()`] instead (also see > [`Buffer.allocUnsafe()`]). -* `size` {Integer} The desired length of the new `Buffer` +* `size` {integer} The desired length of the new `Buffer` Allocates a new `Buffer` of `size` bytes. The `size` must be less than or equal to the value of [`buffer.kMaxLength`]. Otherwise, a [`RangeError`] is thrown. @@ -453,8 +453,8 @@ console.log(buf2.toString()); added: v5.10.0 --> -* `size` {Integer} The desired length of the new `Buffer` -* `fill` {string | Buffer | Integer} A value to pre-fill the new `Buffer` with. +* `size` {integer} The desired length of the new `Buffer` +* `fill` {string|Buffer|integer} A value to pre-fill the new `Buffer` with. **Default:** `0` * `encoding` {string} If `fill` is a string, this is its encoding. **Default:** `'utf8'` @@ -510,7 +510,7 @@ A `TypeError` will be thrown if `size` is not a number. added: v5.10.0 --> -* `size` {Integer} The desired length of the new `Buffer` +* `size` {integer} The desired length of the new `Buffer` Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must be less than or equal to the value of [`buffer.kMaxLength`]. Otherwise, a @@ -556,7 +556,7 @@ additional performance that [`Buffer.allocUnsafe()`] provides. added: v5.10.0 --> -* `size` {Integer} The desired length of the new `Buffer` +* `size` {integer} The desired length of the new `Buffer` Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The `size` must be less than or equal to the value of [`buffer.kMaxLength`]. @@ -609,11 +609,11 @@ A `TypeError` will be thrown if `size` is not a number. added: v0.1.90 --> -* `string` {string | Buffer | TypedArray | DataView | ArrayBuffer} A value to +* `string` {string|Buffer|TypedArray|DataView|ArrayBuffer} A value to calculate the length of * `encoding` {string} If `string` is a string, this is its encoding. **Default:** `'utf8'` -* Returns: {Integer} The number of bytes contained within `string` +* Returns: {integer} The number of bytes contained within `string` Returns the actual byte length of a string. This is not the same as [`String.prototype.length`] since that returns the number of *characters* in @@ -645,7 +645,7 @@ added: v0.11.13 * `buf1` {Buffer} * `buf2` {Buffer} -* Returns: {Integer} +* Returns: {integer} Compares `buf1` to `buf2` typically for the purpose of sorting arrays of `Buffer` instances. This is equivalent to calling @@ -669,7 +669,7 @@ added: v0.7.11 --> * `list` {Array} List of `Buffer` instances to concat -* `totalLength` {Integer} Total length of the `Buffer` instances in `list` +* `totalLength` {integer} Total length of the `Buffer` instances in `list` when concatenated * Returns: {Buffer} @@ -729,8 +729,8 @@ added: v5.10.0 * `arrayBuffer` {ArrayBuffer} An [`ArrayBuffer`] or the `.buffer` property of a [`TypedArray`]. -* `byteOffset` {Integer} Index of first byte to expose. **Default:** `0` -* `length` {Integer} Number of bytes to expose. +* `byteOffset` {integer} Index of first byte to expose. **Default:** `0` +* `length` {integer} Number of bytes to expose. **Default:** `arrayBuffer.length - byteOffset` This creates a view of the [`ArrayBuffer`] without copying the underlying @@ -837,7 +837,7 @@ added: v0.1.101 --> * `obj` {Object} -* Returns: {Boolean} +* Returns: {boolean} Returns `true` if `obj` is a `Buffer`, `false` otherwise. @@ -847,7 +847,7 @@ added: v0.9.1 --> * `encoding` {string} A character encoding name to check -* Returns: {Boolean} +* Returns: {boolean} Returns `true` if `encoding` contains a supported character encoding, or `false` otherwise. @@ -857,7 +857,7 @@ otherwise. added: v0.11.3 --> -* {Integer} **Default:** `8192` +* {integer} **Default:** `8192` This is the number of bytes used to determine the size of pre-allocated, internal `Buffer` instances used for pooling. This value may be modified. @@ -896,17 +896,17 @@ added: v0.11.13 --> * `target` {Buffer} A `Buffer` to compare to -* `targetStart` {Integer} The offset within `target` at which to begin +* `targetStart` {integer} The offset within `target` at which to begin comparison. **Default:** `0` -* `targetEnd` {Integer} The offset with `target` at which to end comparison +* `targetEnd` {integer} The offset with `target` at which to end comparison (not inclusive). Ignored when `targetStart` is `undefined`. **Default:** `target.length` -* `sourceStart` {Integer} The offset within `buf` at which to begin comparison. +* `sourceStart` {integer} The offset within `buf` at which to begin comparison. Ignored when `targetStart` is `undefined`. **Default:** `0` -* `sourceEnd` {Integer} The offset within `buf` at which to end comparison +* `sourceEnd` {integer} The offset within `buf` at which to end comparison (not inclusive). Ignored when `targetStart` is `undefined`. **Default:** [`buf.length`] -* Returns: {Integer} +* Returns: {integer} Compares `buf` with `target` and returns a number indicating whether `buf` comes before, after, or is the same as `target` in sort order. @@ -972,13 +972,13 @@ added: v0.1.90 --> * `target` {Buffer|Uint8Array} A `Buffer` or [`Uint8Array`] to copy into. -* `targetStart` {Integer} The offset within `target` at which to begin +* `targetStart` {integer} The offset within `target` at which to begin copying to. **Default:** `0` -* `sourceStart` {Integer} The offset within `buf` at which to begin copying from. +* `sourceStart` {integer} The offset within `buf` at which to begin copying from. Ignored when `targetStart` is `undefined`. **Default:** `0` -* `sourceEnd` {Integer} The offset within `buf` at which to stop copying (not +* `sourceEnd` {integer} The offset within `buf` at which to stop copying (not inclusive). Ignored when `sourceStart` is `undefined`. **Default:** [`buf.length`] -* Returns: {Integer} The number of bytes copied. +* Returns: {integer} The number of bytes copied. Copies data from a region of `buf` to a region in `target` even if the `target` memory region overlaps with `buf`. @@ -1051,7 +1051,7 @@ added: v0.11.13 --> * `otherBuffer` {Buffer} A `Buffer` to compare to -* Returns: {Boolean} +* Returns: {boolean} Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes, `false` otherwise. @@ -1075,9 +1075,9 @@ console.log(buf1.equals(buf3)); added: v0.5.0 --> -* `value` {string | Buffer | Integer} The value to fill `buf` with -* `offset` {Integer} Where to start filling `buf`. **Default:** `0` -* `end` {Integer} Where to stop filling `buf` (not inclusive). **Default:** [`buf.length`] +* `value` {string|Buffer|integer} The value to fill `buf` with +* `offset` {integer} Where to start filling `buf`. **Default:** `0` +* `end` {integer} Where to stop filling `buf` (not inclusive). **Default:** [`buf.length`] * `encoding` {string} If `value` is a string, this is its encoding. **Default:** `'utf8'` * Returns: {Buffer} A reference to `buf` @@ -1112,11 +1112,11 @@ console.log(Buffer.allocUnsafe(3).fill('\u0222')); added: v5.3.0 --> -* `value` {string | Buffer | Integer} What to search for -* `byteOffset` {Integer} Where to begin searching in `buf`. **Default:** `0` +* `value` {string|Buffer|integer} What to search for +* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0` * `encoding` {string} If `value` is a string, this is its encoding. **Default:** `'utf8'` -* Returns: {Boolean} `true` if `value` was found in `buf`, `false` otherwise +* Returns: {boolean} `true` if `value` was found in `buf`, `false` otherwise Equivalent to [`buf.indexOf() !== -1`][`buf.indexOf()`]. @@ -1153,11 +1153,11 @@ console.log(buf.includes('this', 4)); added: v1.5.0 --> -* `value` {String | Buffer | Integer} What to search for -* `byteOffset` {Integer} Where to begin searching in `buf`. **Default:** `0` +* `value` {string | Buffer | integer} What to search for +* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0` * `encoding` {string} If `value` is a string, this is its encoding. **Default:** `'utf8'` -* Returns: {Integer} The index of the first occurrence of `value` in `buf` or `-1` +* Returns: {integer} The index of the first occurrence of `value` in `buf` or `-1` if `buf` does not contain `value` If `value` is: @@ -1299,12 +1299,12 @@ for (const key of buf.keys()) { added: v6.0.0 --> -* `value` {String | Buffer | Integer} What to search for -* `byteOffset` {Integer} Where to begin searching in `buf`. +* `value` {string | Buffer | integer} What to search for +* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** [`buf.length`]` - 1` * `encoding` {string} If `value` is a string, this is its encoding. **Default:** `'utf8'` -* Returns: {Integer} The index of the last occurrence of `value` in `buf` or `-1` +* Returns: {integer} The index of the last occurrence of `value` in `buf` or `-1` if `buf` does not contain `value` Identical to [`buf.indexOf()`], except `buf` is searched from back to front @@ -1379,7 +1379,7 @@ console.log(b.lastIndexOf('b', [])); added: v0.1.90 --> -* {Integer} +* {integer} Returns the amount of memory allocated for `buf` in bytes. Note that this does not necessarily reflect the amount of "usable" data within `buf`. @@ -1425,9 +1425,9 @@ console.log(buf.length); added: v0.11.15 --> -* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 8` +* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 8` * `noAssert` {boolean} Skip `offset` validation? **Default:** `false` -* Returns: {Number} +* Returns: {number} Reads a 64-bit double from `buf` at the specified `offset` with specified endian format (`readDoubleBE()` returns big endian, `readDoubleLE()` returns @@ -1461,9 +1461,9 @@ console.log(buf.readDoubleLE(1, true)); added: v0.11.15 --> -* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` +* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` * `noAssert` {boolean} Skip `offset` validation? **Default:** `false` -* Returns: {Number} +* Returns: {number} Reads a 32-bit float from `buf` at the specified `offset` with specified endian format (`readFloatBE()` returns big endian, `readFloatLE()` returns @@ -1496,9 +1496,9 @@ console.log(buf.readFloatLE(1, true)); added: v0.5.0 --> -* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1` +* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1` * `noAssert` {boolean} Skip `offset` validation? **Default:** `false` -* Returns: {Integer} +* Returns: {integer} Reads a signed 8-bit integer from `buf` at the specified `offset`. @@ -1528,9 +1528,9 @@ console.log(buf.readInt8(2)); added: v0.5.5 --> -* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2` +* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2` * `noAssert` {boolean} Skip `offset` validation? **Default:** `false` -* Returns: {Integer} +* Returns: {integer} Reads a signed 16-bit integer from `buf` at the specified `offset` with the specified endian format (`readInt16BE()` returns big endian, @@ -1562,9 +1562,9 @@ console.log(buf.readInt16LE(1)); added: v0.5.5 --> -* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` +* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` * `noAssert` {boolean} Skip `offset` validation? **Default:** `false` -* Returns: {Integer} +* Returns: {integer} Reads a signed 32-bit integer from `buf` at the specified `offset` with the specified endian format (`readInt32BE()` returns big endian, @@ -1596,10 +1596,10 @@ console.log(buf.readInt32LE(1)); added: v0.11.15 --> -* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength` -* `byteLength` {Integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6` +* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength` +* `byteLength` {integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6` * `noAssert` {boolean} Skip `offset` and `byteLength` validation? **Default:** `false` -* Returns: {Integer} +* Returns: {integer} Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as a two's complement signed value. Supports up to 48 @@ -1628,9 +1628,9 @@ console.log(buf.readIntBE(1, 6).toString(16)); added: v0.5.0 --> -* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1` +* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1` * `noAssert` {boolean} Skip `offset` validation? **Default:** `false` -* Returns: {Integer} +* Returns: {integer} Reads an unsigned 8-bit integer from `buf` at the specified `offset`. @@ -1658,9 +1658,9 @@ console.log(buf.readUInt8(2)); added: v0.5.5 --> -* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2` +* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2` * `noAssert` {boolean} Skip `offset` validation? **Default:** `false` -* Returns: {Integer} +* Returns: {integer} Reads an unsigned 16-bit integer from `buf` at the specified `offset` with specified endian format (`readUInt16BE()` returns big endian, `readUInt16LE()` @@ -1696,9 +1696,9 @@ console.log(buf.readUInt16LE(2).toString(16)); added: v0.5.5 --> -* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` +* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` * `noAssert` {boolean} Skip `offset` validation? **Default:** `false` -* Returns: {Integer} +* Returns: {integer} Reads an unsigned 32-bit integer from `buf` at the specified `offset` with specified endian format (`readUInt32BE()` returns big endian, @@ -1728,10 +1728,10 @@ console.log(buf.readUInt32LE(1).toString(16)); added: v0.11.15 --> -* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength` -* `byteLength` {Integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6` +* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength` +* `byteLength` {integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6` * `noAssert` {boolean} Skip `offset` and `byteLength` validation? **Default:** `false` -* Returns: {Integer} +* Returns: {integer} Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as an unsigned integer. Supports up to 48 @@ -1760,8 +1760,8 @@ console.log(buf.readUIntBE(1, 6).toString(16)); added: v0.3.0 --> -* `start` {Integer} Where the new `Buffer` will start. **Default:** `0` -* `end` {Integer} Where the new `Buffer` will end (not inclusive). +* `start` {integer} Where the new `Buffer` will start. **Default:** `0` +* `end` {integer} Where the new `Buffer` will end (not inclusive). **Default:** [`buf.length`] * Returns: {Buffer} @@ -1913,10 +1913,10 @@ 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` -* `end` {Integer} The byte offset to stop decoding at (not inclusive). +* `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`] -* Returns: {String} +* Returns: {string} Decodes `buf` to a string according to the specified character encoding in `encoding`. `start` and `end` may be passed to decode only a subset of `buf`. @@ -2023,10 +2023,10 @@ added: v0.1.90 --> * `string` {string} String to be written to `buf` -* `offset` {Integer} Where to start writing `string`. **Default:** `0` -* `length` {Integer} How many bytes to write. **Default:** `buf.length - offset` +* `offset` {integer} Where to start writing `string`. **Default:** `0` +* `length` {integer} How many bytes to write. **Default:** `buf.length - offset` * `encoding` {string} The character encoding of `string`. **Default:** `'utf8'` -* Returns: {Integer} Number of bytes written +* Returns: {integer} Number of bytes written Writes `string` to `buf` at `offset` according to the character encoding in `encoding`. The `length` parameter is the number of bytes to write. If `buf` did not contain @@ -2051,9 +2051,9 @@ added: v0.11.15 --> * `value` {number} Number to be written to `buf` -* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 8` +* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 8` * `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` -* Returns: {Integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian format (`writeDoubleBE()` writes big endian, `writeDoubleLE()` writes little @@ -2086,9 +2086,9 @@ added: v0.11.15 --> * `value` {number} Number to be written to `buf` -* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` +* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` * `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` -* Returns: {Integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian format (`writeFloatBE()` writes big endian, `writeFloatLE()` writes little @@ -2119,10 +2119,10 @@ console.log(buf); added: v0.5.0 --> -* `value` {Integer} Number to be written to `buf` -* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1` +* `value` {integer} Number to be written to `buf` +* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1` * `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` -* Returns: {Integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset`. `value` *should* be a valid signed 8-bit integer. Behavior is undefined when `value` is anything other than @@ -2151,10 +2151,10 @@ console.log(buf); added: v0.5.5 --> -* `value` {Integer} Number to be written to `buf` -* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2` +* `value` {integer} Number to be written to `buf` +* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2` * `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` -* Returns: {Integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian format (`writeInt16BE()` writes big endian, `writeInt16LE()` writes little @@ -2184,10 +2184,10 @@ console.log(buf); added: v0.5.5 --> -* `value` {Integer} Number to be written to `buf` -* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` +* `value` {integer} Number to be written to `buf` +* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` * `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` -* Returns: {Integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian format (`writeInt32BE()` writes big endian, `writeInt32LE()` writes little @@ -2217,12 +2217,12 @@ console.log(buf); added: v0.11.15 --> -* `value` {Integer} Number to be written to `buf` -* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - byteLength` -* `byteLength` {Integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6` +* `value` {integer} Number to be written to `buf` +* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - byteLength` +* `byteLength` {integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6` * `noAssert` {boolean} Skip `value`, `offset`, and `byteLength` validation? **Default:** `false` -* Returns: {Integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written Writes `byteLength` bytes of `value` to `buf` at the specified `offset`. Supports up to 48 bits of accuracy. Behavior is undefined when `value` is @@ -2252,10 +2252,10 @@ console.log(buf); added: v0.5.0 --> -* `value` {Integer} Number to be written to `buf` -* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1` +* `value` {integer} Number to be written to `buf` +* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1` * `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` -* Returns: {Integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset`. `value` *should* be a valid unsigned 8-bit integer. Behavior is undefined when `value` is anything @@ -2284,10 +2284,10 @@ console.log(buf); added: v0.5.5 --> -* `value` {Integer} Number to be written to `buf` -* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2` +* `value` {integer} Number to be written to `buf` +* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2` * `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` -* Returns: {Integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian format (`writeUInt16BE()` writes big endian, `writeUInt16LE()` writes little @@ -2321,10 +2321,10 @@ console.log(buf); added: v0.5.5 --> -* `value` {Integer} Number to be written to `buf` -* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` +* `value` {integer} Number to be written to `buf` +* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` * `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` -* Returns: {Integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian format (`writeUInt32BE()` writes big endian, `writeUInt32LE()` writes little @@ -2356,12 +2356,12 @@ console.log(buf); added: v0.5.5 --> -* `value` {Integer} Number to be written to `buf` -* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - byteLength` -* `byteLength` {Integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6` +* `value` {integer} Number to be written to `buf` +* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - byteLength` +* `byteLength` {integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6` * `noAssert` {boolean} Skip `value`, `offset`, and `byteLength` validation? **Default:** `false` -* Returns: {Integer} `offset` plus the number of bytes written +* Returns: {integer} `offset` plus the number of bytes written Writes `byteLength` bytes of `value` to `buf` at the specified `offset`. Supports up to 48 bits of accuracy. Behavior is undefined when `value` is @@ -2391,7 +2391,7 @@ console.log(buf); added: v0.5.4 --> -* {Integer} **Default:** `50` +* {integer} **Default:** `50` Returns the maximum number of bytes that will be returned when `buf.inspect()` is called. This can be overridden by user modules. See @@ -2405,7 +2405,7 @@ Note that this is a property on the `buffer` module as returned by added: v3.0.0 --> -* {Integer} The largest size allowed for a single `Buffer` instance +* {integer} The largest size allowed for a single `Buffer` instance On 32-bit architectures, this value is `(2^30)-1` (~1GB). On 64-bit architectures, this value is `(2^31)-1` (~2GB). @@ -2457,7 +2457,7 @@ deprecated: v6.0.0 > Stability: 0 - Deprecated: Use [`Buffer.allocUnsafeSlow()`] instead. -* `size` {Integer} The desired length of the new `SlowBuffer` +* `size` {integer} The desired length of the new `SlowBuffer` Allocates a new `SlowBuffer` of `size` bytes. The `size` must be less than or equal to the value of [`buffer.kMaxLength`]. Otherwise, a [`RangeError`] is diff --git a/doc/api/child_process.md b/doc/api/child_process.md index d91a1a5e5e60df..21fb32c1ae0596 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -135,9 +135,9 @@ added: v0.1.90 understand the `-c` switch on UNIX or `/s /c` on Windows. On Windows, command line parsing should be compatible with `cmd.exe`.) * `timeout` {number} (Default: `0`) - * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on + * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on stdout or stderr - if exceeded child process is killed (Default: `200*1024`) - * `killSignal` {string|Integer} (Default: `'SIGTERM'`) + * `killSignal` {string|integer} (Default: `'SIGTERM'`) * `uid` {number} Sets the user identity of the process. (See setuid(2).) * `gid` {number} Sets the group identity of the process. (See setgid(2).) * `callback` {Function} called with the output when process terminates @@ -212,9 +212,9 @@ added: v0.1.91 * `env` {Object} Environment key-value pairs * `encoding` {string} (Default: `'utf8'`) * `timeout` {number} (Default: `0`) - * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on + * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on stdout or stderr - if exceeded child process is killed (Default: `200*1024`) - * `killSignal` {string|Integer} (Default: `'SIGTERM'`) + * `killSignal` {string|integer} (Default: `'SIGTERM'`) * `uid` {number} Sets the user identity of the process. (See setuid(2).) * `gid` {number} Sets the group identity of the process. (See setgid(2).) * `callback` {Function} called with the output when process terminates @@ -583,7 +583,7 @@ added: v0.11.12 * `input` {string|Buffer} 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'`) + * `stdio` {string|Array} Child's stdio configuration. (Default: `'pipe'`) - `stderr` by default will be output to the parent process' stderr unless `stdio` is specified * `env` {Object} Environment key-value pairs @@ -591,9 +591,9 @@ added: v0.11.12 * `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`) - * `killSignal` {string|Integer} The signal value to be used when the spawned + * `killSignal` {string|integer} The signal value to be used when the spawned process will be killed. (Default: `'SIGTERM'`) - * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on + * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on stdout or stderr - if exceeded child process is killed * `encoding` {string} The encoding used for all stdio inputs and outputs. (Default: `'buffer'`) * Returns: {Buffer|string} The stdout from the command @@ -621,7 +621,7 @@ added: v0.11.12 * `input` {string|Buffer} 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'`) + * `stdio` {string|Array} Child's stdio configuration. (Default: `'pipe'`) - `stderr` by default will be output to the parent process' stderr unless `stdio` is specified * `env` {Object} Environment key-value pairs @@ -633,9 +633,9 @@ added: v0.11.12 * `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`) - * `killSignal` {string|Integer} The signal value to be used when the spawned + * `killSignal` {string|integer} The signal value to be used when the spawned process will be killed. (Default: `'SIGTERM'`) - * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on + * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on stdout or stderr - if exceeded child process is killed * `encoding` {string} The encoding used for all stdio inputs and outputs. (Default: `'buffer'`) @@ -669,15 +669,15 @@ added: v0.11.12 * `input` {string|Buffer} 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. + * `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`) - * `killSignal` {string|Integer} The signal value to be used when the spawned + * `killSignal` {string|integer} The signal value to be used when the spawned process will be killed. (Default: `'SIGTERM'`) - * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on + * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on stdout or stderr - if exceeded child process is killed * `encoding` {string} The encoding used for all stdio inputs and outputs. (Default: `'buffer'`) @@ -797,7 +797,7 @@ to send messages. added: v0.7.2 --> -* {Boolean} Set to `false` after `child.disconnect()` is called +* {boolean} Set to `false` after `child.disconnect()` is called The `child.connected` property indicates whether it is still possible to send and receive messages from a child process. When `child.connected` is `false`, it @@ -884,7 +884,7 @@ setTimeout(() => { added: v0.1.90 --> -* {Number} Integer +* {number} Integer Returns the process identifier (PID) of the child process. @@ -907,7 +907,7 @@ added: v0.5.9 * `sendHandle` {Handle} * `options` {Object} * `callback` {Function} -* Returns: {Boolean} +* Returns: {boolean} When an IPC channel has been established between the parent and child ( i.e. when using [`child_process.fork()`][]), the `child.send()` method can be diff --git a/doc/api/cluster.md b/doc/api/cluster.md index 850881d787bf14..bdf58e2b45f279 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -328,7 +328,7 @@ if (cluster.isMaster) { added: v6.0.0 --> -* {Boolean} +* {boolean} Set by calling `.kill()` or `.disconnect()`. Until then, it is `undefined`. @@ -352,7 +352,7 @@ worker.kill(); added: v0.8.0 --> -* {Number} +* {number} Each new worker is given its own unique id, this id is stored in the `id`. @@ -672,7 +672,7 @@ This can only be called from the master process. added: v0.8.1 --> -* {Boolean} +* {boolean} True if the process is a master. This is determined by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID` is @@ -683,7 +683,7 @@ undefined, then `isMaster` is `true`. added: v0.6.0 --> -* {Boolean} +* {boolean} True if the process is not a master (it is the negation of `cluster.isMaster`). diff --git a/doc/api/console.md b/doc/api/console.md index 7bc54641a21714..4813988d77b978 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -155,6 +155,11 @@ console.log('this will also print'); +* `obj` {any} +* `options` {Object} + * `showHidden` {boolean} + * `depth` {number} + * `colors` {boolean} Uses [`util.inspect()`][] on `obj` and prints the resulting string to `stdout`. This function bypasses any custom `inspect()` function defined on `obj`. An @@ -227,6 +232,7 @@ values are concatenated. See [`util.format()`][] for more information. +* `label` {string} 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 you call @@ -237,6 +243,7 @@ milliseconds to `stdout`. Timer durations are accurate to the sub-millisecond. +* `label` {string} Stops a timer that was previously started by calling [`console.time()`][] and prints the result to `stdout`: diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 17d273d115cea4..7b4a483b11e719 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -901,8 +901,8 @@ The `private_key` argument can be an object or a string. If `private_key` is a string, it is treated as a raw key with no passphrase. If `private_key` is an object, it is interpreted as a hash containing two properties: -* `key` : {String} - PEM encoded private key -* `passphrase` : {String} - passphrase for the private key +* `key`: {string} - PEM encoded private key +* `passphrase`: {string} - passphrase for the private key The `output_format` can specify one of `'latin1'`, `'hex'` or `'base64'`. If `output_format` is provided a string is returned; otherwise a [`Buffer`][] is @@ -1410,8 +1410,8 @@ treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. If `private_key` is an object, it is interpreted as a hash object with the keys: -* `key` : {String} - PEM encoded private key -* `passphrase` : {String} - Optional passphrase for the private key +* `key`: {string} - PEM encoded private key +* `passphrase`: {string} - Optional passphrase for the private key * `padding` : An optional padding value, one of the following: * `crypto.constants.RSA_NO_PADDING` * `crypto.constants.RSA_PKCS1_PADDING` @@ -1447,8 +1447,8 @@ treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. If `private_key` is an object, it is interpreted as a hash object with the keys: -* `key` : {String} - PEM encoded private key -* `passphrase` : {String} - Optional passphrase for the private key +* `key`: {string} - PEM encoded private key +* `passphrase`: {string} - Optional passphrase for the private key * `padding` : An optional padding value, one of the following: * `crypto.constants.RSA_NO_PADDING` * `crypto.constants.RSA_PKCS1_PADDING` @@ -1467,8 +1467,8 @@ treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. If `public_key` is an object, it is interpreted as a hash object with the keys: -* `key` : {String} - PEM encoded public key -* `passphrase` : {String} - Optional passphrase for the private key +* `key`: {string} - PEM encoded public key +* `passphrase`: {string} - Optional passphrase for the private key * `padding` : An optional padding value, one of the following: * `crypto.constants.RSA_NO_PADDING` * `crypto.constants.RSA_PKCS1_PADDING` @@ -1491,8 +1491,8 @@ treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. If `public_key` is an object, it is interpreted as a hash object with the keys: -* `key` : {String} - PEM encoded public key -* `passphrase` : {String} - Optional passphrase for the private key +* `key`: {string} - PEM encoded public key +* `passphrase`: {string} - Optional passphrase for the private key * `padding` : An optional padding value, one of the following: * `crypto.constants.RSA_NO_PADDING` * `crypto.constants.RSA_PKCS1_PADDING` diff --git a/doc/api/dns.md b/doc/api/dns.md index 301daaa6dce95d..9c78ddd6545c75 100644 --- a/doc/api/dns.md +++ b/doc/api/dns.md @@ -76,13 +76,13 @@ Alternatively, `options` can be an object containing these properties: * `family` {number} - The record family. If present, must be the integer `4` or `6`. If not provided, both IP v4 and v6 addresses are accepted. -* `hints`: {Number} - If present, it should be one or more of the supported +* `hints`: {number} - If present, it should be one or more of the supported `getaddrinfo` flags. If `hints` is not provided, then no flags are passed to `getaddrinfo`. Multiple flags can be passed through `hints` by bitwise `OR`ing their values. See [supported `getaddrinfo` flags][] for more information on supported flags. -* `all`: {Boolean} - When `true`, the callback returns all resolved addresses +* `all`: {boolean} - When `true`, the callback returns all resolved addresses in an array, otherwise returns a single address. Defaults to `false`. All properties are optional. diff --git a/doc/api/errors.md b/doc/api/errors.md index 94c06541c64842..9fc884b5625951 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -244,7 +244,7 @@ new MyError().stack; ### Error.stackTraceLimit -* {Number} +* {number} The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or @@ -258,7 +258,7 @@ not capture any frames. ### error.message -* {String} +* {string} The `error.message` property is the string description of the error as set by calling `new Error(message)`. The `message` passed to the constructor will also appear in the first line of @@ -274,7 +274,7 @@ console.error(err.message); ### error.stack -* {String} +* {string} The `error.stack` property is a string describing the point in the code at which the `Error` was instantiated. @@ -450,14 +450,14 @@ added properties. #### error.code -* {String} +* {string} The `error.code` property is a string representing the error code, which is always `E` followed by a sequence of capital letters. #### error.errno -* {String | Number} +* {string|number} The `error.errno` property is a number or a string. The number is a **negative** value which corresponds to the error code defined in @@ -467,27 +467,27 @@ In case of a string, it is the same as `error.code`. #### error.syscall -* {String} +* {string} The `error.syscall` property is a string describing the [syscall][] that failed. #### error.path -* {String} +* {string} When present (e.g. in `fs` or `child_process`), the `error.path` property is a string containing a relevant invalid pathname. #### error.address -* {String} +* {string} When present (e.g. in `net` or `dgram`), the `error.address` property is a string describing the address to which the connection failed. #### error.port -* {Number} +* {number} When present (e.g. in `net` or `dgram`), the `error.port` property is a number representing the connection's port that is not available. diff --git a/doc/api/fs.md b/doc/api/fs.md index 9ee03b2a2fec1d..dcaeef23abbb99 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -122,7 +122,7 @@ added: v0.5.8 --> * `eventType` {string} The type of fs change -* `filename` {string | Buffer} The filename that changed (if relevant/available) +* `filename` {string|Buffer} The filename that changed (if relevant/available) Emitted when something changes in a watched directory or file. See more details in [`fs.watch()`][]. @@ -178,8 +178,9 @@ Emitted when the ReadStream's file is opened. added: v0.1.93 --> -Emitted when the `ReadStream`'s underlying file descriptor has been closed -using the `fs.close()` method. +* `fd` {integer} Integer file descriptor used by the ReadStream. + +Emitted when the ReadStream's file is opened. ### readStream.bytesRead -Emitted when the `WriteStream`'s underlying file descriptor has been closed -using the `fs.close()` method. +* `fd` {integer} Integer file descriptor used by the WriteStream. + +Emitted when the WriteStream's file is opened. ### writeStream.bytesWritten -* `path` {string | Buffer} -* `mode` {Integer} +* `path` {string|Buffer} +* `mode` {integer} * `callback` {Function} Tests a user's permissions for the file or directory specified by `path`. @@ -438,8 +440,8 @@ process. added: v0.11.15 --> -* `path` {string | Buffer} -* `mode` {Integer} +* `path` {string|Buffer} +* `mode` {integer} Synchronous version of [`fs.access()`][]. This throws if any accessibility checks fail, and does nothing otherwise. @@ -449,11 +451,11 @@ checks fail, and does nothing otherwise. added: v0.6.7 --> -* `file` {string | Buffer | Number} filename or file descriptor -* `data` {string | Buffer} -* `options` {Object | String} - * `encoding` {string | Null} default = `'utf8'` - * `mode` {Integer} default = `0o666` +* `file` {string|Buffer|number} filename or file descriptor +* `data` {string|Buffer} +* `options` {Object|string} + * `encoding` {string|null} default = `'utf8'` + * `mode` {integer} default = `0o666` * `flag` {string} default = `'a'` * `callback` {Function} @@ -485,11 +487,11 @@ automatically._ added: v0.6.7 --> -* `file` {string | Buffer | Number} filename or file descriptor -* `data` {string | Buffer} -* `options` {Object | String} - * `encoding` {string | Null} default = `'utf8'` - * `mode` {Integer} default = `0o666` +* `file` {string|Buffer|number} filename or file descriptor +* `data` {string|Buffer} +* `options` {Object|string} + * `encoding` {string|null} default = `'utf8'` + * `mode` {integer} default = `0o666` * `flag` {string} default = `'a'` The synchronous version of [`fs.appendFile()`][]. Returns `undefined`. @@ -499,8 +501,8 @@ The synchronous version of [`fs.appendFile()`][]. Returns `undefined`. added: v0.1.30 --> -* `path` {string | Buffer} -* `mode` {Integer} +* `path` {string|Buffer} +* `mode` {integer} * `callback` {Function} Asynchronous chmod(2). No arguments other than a possible exception are given @@ -511,8 +513,8 @@ to the completion callback. added: v0.6.7 --> -* `path` {string | Buffer} -* `mode` {Integer} +* `path` {string|Buffer} +* `mode` {integer} Synchronous chmod(2). Returns `undefined`. @@ -521,9 +523,9 @@ Synchronous chmod(2). Returns `undefined`. added: v0.1.97 --> -* `path` {string | Buffer} -* `uid` {Integer} -* `gid` {Integer} +* `path` {string|Buffer} +* `uid` {integer} +* `gid` {integer} * `callback` {Function} Asynchronous chown(2). No arguments other than a possible exception are given @@ -534,9 +536,9 @@ to the completion callback. added: v0.1.97 --> -* `path` {string | Buffer} -* `uid` {Integer} -* `gid` {Integer} +* `path` {string|Buffer} +* `uid` {integer} +* `gid` {integer} Synchronous chown(2). Returns `undefined`. @@ -545,7 +547,7 @@ Synchronous chown(2). Returns `undefined`. added: v0.0.2 --> -* `fd` {Integer} +* `fd` {integer} * `callback` {Function} Asynchronous close(2). No arguments other than a possible exception are given @@ -556,7 +558,7 @@ to the completion callback. added: v0.1.21 --> -* `fd` {Integer} +* `fd` {integer} Synchronous close(2). Returns `undefined`. @@ -571,15 +573,15 @@ operations. The specific constants currently defined are described in added: v0.1.31 --> -* `path` {string | Buffer} -* `options` {string | Object} +* `path` {string|Buffer} +* `options` {string|Object} * `flags` {string} * `encoding` {string} - * `fd` {Integer} - * `mode` {Integer} + * `fd` {integer} + * `mode` {integer} * `autoClose` {boolean} - * `start` {Integer} - * `end` {Integer} + * `start` {integer} + * `end` {integer} Returns a new [`ReadStream`][] object. (See [Readable Stream][]). @@ -632,14 +634,14 @@ If `options` is a string, then it specifies the encoding. added: v0.1.31 --> -* `path` {string | Buffer} -* `options` {string | Object} +* `path` {string|Buffer} +* `options` {string|Object} * `flags` {string} * `defaultEncoding` {string} - * `fd` {Integer} - * `mode` {Integer} + * `fd` {integer} + * `mode` {integer} * `autoClose` {boolean} - * `start` {Integer} + * `start` {integer} Returns a new [`WriteStream`][] object. (See [Writable Stream][]). @@ -682,7 +684,7 @@ deprecated: v1.0.0 > Stability: 0 - Deprecated: Use [`fs.stat()`][] or [`fs.access()`][] instead. -* `path` {string | Buffer} +* `path` {string|Buffer} * `callback` {Function} Test whether or not the given path exists by checking with the file system. @@ -784,7 +786,7 @@ process. added: v0.1.21 --> -* `path` {string | Buffer} +* `path` {string|Buffer} Synchronous version of [`fs.exists()`][]. Returns `true` if the file exists, `false` otherwise. @@ -799,8 +801,8 @@ a callback.) added: v0.4.7 --> -* `fd` {Integer} -* `mode` {Integer} +* `fd` {integer} +* `mode` {integer} * `callback` {Function} Asynchronous fchmod(2). No arguments other than a possible exception @@ -811,8 +813,8 @@ are given to the completion callback. added: v0.4.7 --> -* `fd` {Integer} -* `mode` {Integer} +* `fd` {integer} +* `mode` {integer} Synchronous fchmod(2). Returns `undefined`. @@ -821,9 +823,9 @@ Synchronous fchmod(2). Returns `undefined`. added: v0.4.7 --> -* `fd` {Integer} -* `uid` {Integer} -* `gid` {Integer} +* `fd` {integer} +* `uid` {integer} +* `gid` {integer} * `callback` {Function} Asynchronous fchown(2). No arguments other than a possible exception are given @@ -834,9 +836,9 @@ to the completion callback. added: v0.4.7 --> -* `fd` {Integer} -* `uid` {Integer} -* `gid` {Integer} +* `fd` {integer} +* `uid` {integer} +* `gid` {integer} Synchronous fchown(2). Returns `undefined`. @@ -845,7 +847,7 @@ Synchronous fchown(2). Returns `undefined`. added: v0.1.96 --> -* `fd` {Integer} +* `fd` {integer} * `callback` {Function} Asynchronous fdatasync(2). No arguments other than a possible exception are @@ -856,7 +858,7 @@ given to the completion callback. added: v0.1.96 --> -* `fd` {Integer} +* `fd` {integer} Synchronous fdatasync(2). Returns `undefined`. @@ -865,7 +867,7 @@ Synchronous fdatasync(2). Returns `undefined`. added: v0.1.95 --> -* `fd` {Integer} +* `fd` {integer} * `callback` {Function} Asynchronous fstat(2). The callback gets two arguments `(err, stats)` where @@ -877,7 +879,7 @@ except that the file to be stat-ed is specified by the file descriptor `fd`. added: v0.1.95 --> -* `fd` {Integer} +* `fd` {integer} Synchronous fstat(2). Returns an instance of [`fs.Stats`][]. @@ -886,7 +888,7 @@ Synchronous fstat(2). Returns an instance of [`fs.Stats`][]. added: v0.1.96 --> -* `fd` {Integer} +* `fd` {integer} * `callback` {Function} Asynchronous fsync(2). No arguments other than a possible exception are given @@ -897,7 +899,7 @@ to the completion callback. added: v0.1.96 --> -* `fd` {Integer} +* `fd` {integer} Synchronous fsync(2). Returns `undefined`. @@ -906,8 +908,8 @@ Synchronous fsync(2). Returns `undefined`. added: v0.8.6 --> -* `fd` {Integer} -* `len` {Integer} default = `0` +* `fd` {integer} +* `len` {integer} default = `0` * `callback` {Function} Asynchronous ftruncate(2). No arguments other than a possible exception are @@ -959,8 +961,8 @@ The last three bytes are null bytes ('\0'), to compensate the over-truncation. added: v0.8.6 --> -* `fd` {Integer} -* `len` {Integer} default = `0` +* `fd` {integer} +* `len` {integer} default = `0` Synchronous ftruncate(2). Returns `undefined`. @@ -969,9 +971,9 @@ Synchronous ftruncate(2). Returns `undefined`. added: v0.4.2 --> -* `fd` {Integer} -* `atime` {Integer} -* `mtime` {Integer} +* `fd` {integer} +* `atime` {integer} +* `mtime` {integer} * `callback` {Function} Change the file timestamps of a file referenced by the supplied file @@ -982,9 +984,9 @@ descriptor. added: v0.4.2 --> -* `fd` {Integer} -* `atime` {Integer} -* `mtime` {Integer} +* `fd` {integer} +* `atime` {integer} +* `mtime` {integer} Synchronous version of [`fs.futimes()`][]. Returns `undefined`. @@ -993,8 +995,8 @@ Synchronous version of [`fs.futimes()`][]. Returns `undefined`. deprecated: v0.4.7 --> -* `path` {string | Buffer} -* `mode` {Integer} +* `path` {string|Buffer} +* `mode` {integer} * `callback` {Function} Asynchronous lchmod(2). No arguments other than a possible exception @@ -1007,8 +1009,8 @@ Only available on macOS. deprecated: v0.4.7 --> -* `path` {string | Buffer} -* `mode` {Integer} +* `path` {string|Buffer} +* `mode` {integer} Synchronous lchmod(2). Returns `undefined`. @@ -1017,9 +1019,9 @@ Synchronous lchmod(2). Returns `undefined`. deprecated: v0.4.7 --> -* `path` {string | Buffer} -* `uid` {Integer} -* `gid` {Integer} +* `path` {string|Buffer} +* `uid` {integer} +* `gid` {integer} * `callback` {Function} Asynchronous lchown(2). No arguments other than a possible exception are given @@ -1030,9 +1032,9 @@ to the completion callback. deprecated: v0.4.7 --> -* `path` {string | Buffer} -* `uid` {Integer} -* `gid` {Integer} +* `path` {string|Buffer} +* `uid` {integer} +* `gid` {integer} Synchronous lchown(2). Returns `undefined`. @@ -1041,8 +1043,8 @@ Synchronous lchown(2). Returns `undefined`. added: v0.1.31 --> -* `existingPath` {string | Buffer} -* `newPath` {string | Buffer} +* `existingPath` {string|Buffer} +* `newPath` {string|Buffer} * `callback` {Function} Asynchronous link(2). No arguments other than a possible exception are given to @@ -1053,8 +1055,8 @@ the completion callback. added: v0.1.31 --> -* `existingPath` {string | Buffer} -* `newPath` {string | Buffer} +* `existingPath` {string|Buffer} +* `newPath` {string|Buffer} Synchronous link(2). Returns `undefined`. @@ -1063,7 +1065,7 @@ Synchronous link(2). Returns `undefined`. added: v0.1.30 --> -* `path` {string | Buffer} +* `path` {string|Buffer} * `callback` {Function} Asynchronous lstat(2). The callback gets two arguments `(err, stats)` where @@ -1076,7 +1078,7 @@ not the file that it refers to. added: v0.1.30 --> -* `path` {string | Buffer} +* `path` {string|Buffer} Synchronous lstat(2). Returns an instance of [`fs.Stats`][]. @@ -1085,8 +1087,8 @@ Synchronous lstat(2). Returns an instance of [`fs.Stats`][]. added: v0.1.8 --> -* `path` {string | Buffer} -* `mode` {Integer} +* `path` {string|Buffer} +* `mode` {integer} * `callback` {Function} Asynchronous mkdir(2). No arguments other than a possible exception are given @@ -1097,8 +1099,8 @@ to the completion callback. `mode` defaults to `0o777`. added: v0.1.21 --> -* `path` {string | Buffer} -* `mode` {Integer} +* `path` {string|Buffer} +* `mode` {integer} Synchronous mkdir(2). Returns `undefined`. @@ -1108,7 +1110,7 @@ added: v5.10.0 --> * `prefix` {string} -* `options` {string | Object} +* `options` {string|Object} * `encoding` {string} default = `'utf8'` * `callback` {Function} @@ -1170,7 +1172,7 @@ added: v5.10.0 --> * `prefix` {string} -* `options` {string | Object} +* `options` {string|Object} * `encoding` {string} default = `'utf8'` The synchronous version of [`fs.mkdtemp()`][]. Returns the created @@ -1184,9 +1186,9 @@ object with an `encoding` property specifying the character encoding to use. added: v0.0.2 --> -* `path` {string | Buffer} -* `flags` {string | Number} -* `mode` {Integer} +* `path` {string|Buffer} +* `flags` {string|number} +* `mode` {integer} * `callback` {Function} Asynchronous file open. See open(2). `flags` can be: @@ -1268,9 +1270,9 @@ fs.open('', 'a+', (err, fd) => { added: v0.1.21 --> -* `path` {string | Buffer} -* `flags` {string | Number} -* `mode` {Integer} +* `path` {string|Buffer} +* `flags` {string|number} +* `mode` {integer} Synchronous version of [`fs.open()`][]. Returns an integer representing the file descriptor. @@ -1280,11 +1282,11 @@ descriptor. added: v0.0.2 --> -* `fd` {Integer} +* `fd` {integer} * `buffer` {string | Buffer} -* `offset` {Integer} -* `length` {Integer} -* `position` {Integer} +* `offset` {integer} +* `length` {integer} +* `position` {integer} * `callback` {Function} Read data from the file specified by `fd`. @@ -1305,8 +1307,8 @@ The callback is given the three arguments, `(err, bytesRead, buffer)`. added: v0.1.8 --> -* `path` {string | Buffer} -* `options` {string | Object} +* `path` {string|Buffer} +* `options` {string|Object} * `encoding` {string} default = `'utf8'` * `callback` {Function} @@ -1324,8 +1326,8 @@ the filenames returned will be passed as `Buffer` objects. added: v0.1.21 --> -* `path` {string | Buffer} -* `options` {string | Object} +* `path` {string|Buffer} +* `options` {string|Object} * `encoding` {string} default = `'utf8'` Synchronous readdir(3). Returns an array of filenames excluding `'.'` and @@ -1341,9 +1343,9 @@ the filenames returned will be passed as `Buffer` objects. added: v0.1.29 --> -* `file` {string | Buffer | Integer} filename or file descriptor -* `options` {Object | String} - * `encoding` {string | Null} default = `null` +* `file` {string|Buffer|integer} filename or file descriptor +* `options` {Object|string} + * `encoding` {string|null} default = `null` * `flag` {string} default = `'r'` * `callback` {Function} @@ -1377,9 +1379,9 @@ automatically._ added: v0.1.8 --> -* `file` {string | Buffer | Integer} filename or file descriptor -* `options` {Object | String} - * `encoding` {string | Null} default = `null` +* `file` {string|Buffer|integer} filename or file descriptor +* `options` {Object|string} + * `encoding` {string|null} default = `null` * `flag` {string} default = `'r'` Synchronous version of [`fs.readFile`][]. Returns the contents of the `file`. @@ -1392,8 +1394,8 @@ string. Otherwise it returns a buffer. added: v0.1.31 --> -* `path` {string | Buffer} -* `options` {string | Object} +* `path` {string|Buffer} +* `options` {string|Object} * `encoding` {string} default = `'utf8'` * `callback` {Function} @@ -1410,8 +1412,8 @@ the link path returned will be passed as a `Buffer` object. added: v0.1.31 --> -* `path` {string | Buffer} -* `options` {string | Object} +* `path` {string|Buffer} +* `options` {string|Object} * `encoding` {string} default = `'utf8'` Synchronous readlink(2). Returns the symbolic link's string value. @@ -1426,11 +1428,11 @@ the link path returned will be passed as a `Buffer` object. added: v0.1.21 --> -* `fd` {Integer} +* `fd` {integer} * `buffer` {string | Buffer} -* `offset` {Integer} -* `length` {Integer} -* `position` {Integer} +* `offset` {integer} +* `length` {integer} +* `position` {integer} Synchronous version of [`fs.read()`][]. Returns the number of `bytesRead`. @@ -1439,8 +1441,8 @@ Synchronous version of [`fs.read()`][]. Returns the number of `bytesRead`. added: v0.1.31 --> -* `path` {string | Buffer} -* `options` {string | Object} +* `path` {string|Buffer} +* `options` {string|Object} * `encoding` {string} default = `'utf8'` * `callback` {Function} @@ -1459,8 +1461,8 @@ the path returned will be passed as a `Buffer` object. added: v0.1.31 --> -* `path` {string | Buffer}; -* `options` {string | Object} +* `path` {string|Buffer}; +* `options` {string|Object} * `encoding` {string} default = `'utf8'` Synchronous realpath(3). Returns the resolved path. @@ -1477,8 +1479,8 @@ will be passed as a `Buffer` object. added: v0.0.2 --> -* `oldPath` {string | Buffer} -* `newPath` {string | Buffer} +* `oldPath` {string|Buffer} +* `newPath` {string|Buffer} * `callback` {Function} Asynchronous rename(2). No arguments other than a possible exception are given @@ -1489,8 +1491,8 @@ to the completion callback. added: v0.1.21 --> -* `oldPath` {string | Buffer} -* `newPath` {string | Buffer} +* `oldPath` {string|Buffer} +* `newPath` {string|Buffer} Synchronous rename(2). Returns `undefined`. @@ -1499,7 +1501,7 @@ Synchronous rename(2). Returns `undefined`. added: v0.0.2 --> -* `path` {string | Buffer} +* `path` {string|Buffer} * `callback` {Function} Asynchronous rmdir(2). No arguments other than a possible exception are given @@ -1510,7 +1512,7 @@ to the completion callback. added: v0.1.21 --> -* `path` {string | Buffer} +* `path` {string|Buffer} Synchronous rmdir(2). Returns `undefined`. @@ -1519,7 +1521,7 @@ Synchronous rmdir(2). Returns `undefined`. added: v0.0.2 --> -* `path` {string | Buffer} +* `path` {string|Buffer} * `callback` {Function} Asynchronous stat(2). The callback gets two arguments `(err, stats)` where @@ -1540,7 +1542,7 @@ is recommended. added: v0.1.21 --> -* `path` {string | Buffer} +* `path` {string|Buffer} Synchronous stat(2). Returns an instance of [`fs.Stats`][]. @@ -1549,8 +1551,8 @@ Synchronous stat(2). Returns an instance of [`fs.Stats`][]. added: v0.1.31 --> -* `target` {string | Buffer} -* `path` {string | Buffer} +* `target` {string|Buffer} +* `path` {string|Buffer} * `type` {string} * `callback` {Function} @@ -1574,8 +1576,8 @@ It creates a symbolic link named "new-port" that points to "foo". added: v0.1.31 --> -* `target` {string | Buffer} -* `path` {string | Buffer} +* `target` {string|Buffer} +* `path` {string|Buffer} * `type` {string} Synchronous symlink(2). Returns `undefined`. @@ -1585,8 +1587,8 @@ Synchronous symlink(2). Returns `undefined`. added: v0.8.6 --> -* `path` {string | Buffer} -* `len` {Integer} default = `0` +* `path` {string|Buffer} +* `len` {integer} default = `0` * `callback` {Function} Asynchronous truncate(2). No arguments other than a possible exception are @@ -1598,8 +1600,8 @@ first argument. In this case, `fs.ftruncate()` is called. added: v0.8.6 --> -* `path` {string | Buffer} -* `len` {Integer} default = `0` +* `path` {string|Buffer} +* `len` {integer} default = `0` Synchronous truncate(2). Returns `undefined`. A file descriptor can also be passed as the first argument. In this case, `fs.ftruncateSync()` is called. @@ -1609,7 +1611,7 @@ passed as the first argument. In this case, `fs.ftruncateSync()` is called. added: v0.0.2 --> -* `path` {string | Buffer} +* `path` {string|Buffer} * `callback` {Function} Asynchronous unlink(2). No arguments other than a possible exception are given @@ -1620,7 +1622,7 @@ to the completion callback. added: v0.1.21 --> -* `path` {string | Buffer} +* `path` {string|Buffer} Synchronous unlink(2). Returns `undefined`. @@ -1629,7 +1631,7 @@ Synchronous unlink(2). Returns `undefined`. added: v0.1.31 --> -* `filename` {string | Buffer} +* `filename` {string|Buffer} * `listener` {Function} Stop watching for changes on `filename`. If `listener` is specified, only that @@ -1648,9 +1650,9 @@ when possible._ added: v0.4.2 --> -* `path` {string | Buffer} -* `atime` {Integer} -* `mtime` {Integer} +* `path` {string|Buffer} +* `atime` {integer} +* `mtime` {integer} * `callback` {Function} Change file timestamps of the file referenced by the supplied path. @@ -1670,9 +1672,9 @@ follow these rules: added: v0.4.2 --> -* `path` {string | Buffer} -* `atime` {Integer} -* `mtime` {Integer} +* `path` {string|Buffer} +* `atime` {integer} +* `mtime` {integer} Synchronous version of [`fs.utimes()`][]. Returns `undefined`. @@ -1681,8 +1683,8 @@ Synchronous version of [`fs.utimes()`][]. Returns `undefined`. added: v0.5.10 --> -* `filename` {string | Buffer} -* `options` {string | Object} +* `filename` {string|Buffer} +* `options` {string|Object} * `persistent` {boolean} Indicates whether the process should continue to run as long as files are being watched. default = `true` * `recursive` {boolean} Indicates whether all subdirectories should be @@ -1784,10 +1786,10 @@ fs.watch('somedir', (eventType, filename) => { added: v0.1.31 --> -* `filename` {string | Buffer} +* `filename` {string|Buffer} * `options` {Object} * `persistent` {boolean} - * `interval` {Integer} + * `interval` {integer} * `listener` {Function} Watch for changes on `filename`. The callback `listener` will be called each @@ -1830,11 +1832,11 @@ _Note: [`fs.watch()`][] is more efficient than `fs.watchFile` and added: v0.0.2 --> -* `fd` {Integer} -* `buffer` {String | Buffer} -* `offset` {Integer} -* `length` {Integer} -* `position` {Integer} +* `fd` {integer} +* `buffer` {string | Buffer} +* `offset` {integer} +* `length` {integer} +* `position` {integer} * `callback` {Function} Write `buffer` to the file specified by `fd`. @@ -1862,9 +1864,9 @@ the end of the file. added: v0.11.5 --> -* `fd` {Integer} +* `fd` {integer} * `data` {string | Buffer} -* `position` {Integer} +* `position` {integer} * `encoding` {string} * `callback` {Function} @@ -1898,11 +1900,11 @@ the end of the file. added: v0.1.29 --> -* `file` {string | Buffer | Integer} filename or file descriptor +* `file` {string | Buffer | integer} filename or file descriptor * `data` {string | Buffer} -* `options` {Object | String} +* `options` {Object | string} * `encoding` {string | Null} default = `'utf8'` - * `mode` {Integer} default = `0o666` + * `mode` {integer} default = `0o666` * `flag` {string} default = `'w'` * `callback` {Function} @@ -1941,11 +1943,11 @@ automatically._ added: v0.1.29 --> -* `file` {string | Buffer | Integer} filename or file descriptor +* `file` {string | Buffer | integer} filename or file descriptor * `data` {string | Buffer} -* `options` {Object | String} +* `options` {Object | string} * `encoding` {string | Null} default = `'utf8'` - * `mode` {Integer} default = `0o666` + * `mode` {integer} default = `0o666` * `flag` {string} default = `'w'` The synchronous version of [`fs.writeFile()`][]. Returns `undefined`. @@ -1955,20 +1957,20 @@ The synchronous version of [`fs.writeFile()`][]. Returns `undefined`. added: v0.1.21 --> -* `fd` {Integer} -* `buffer` {String | Buffer} -* `offset` {Integer} -* `length` {Integer} -* `position` {Integer} +* `fd` {integer} +* `buffer` {string | Buffer} +* `offset` {integer} +* `length` {integer} +* `position` {integer} ## fs.writeSync(fd, data[, position[, encoding]]) -* `fd` {Integer} +* `fd` {integer} * `data` {string | Buffer} -* `position` {Integer} +* `position` {integer} * `encoding` {string} Synchronous versions of [`fs.write()`][]. Returns the number of bytes written. diff --git a/doc/api/globals.md b/doc/api/globals.md index a60cd4cc226fb2..b0467cdacde3a5 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -27,7 +27,7 @@ added: v0.1.27 -* {String} +* {string} The directory name of the current module. This the same as the [`path.dirname()`][] of the [`__filename`][]. @@ -50,7 +50,7 @@ added: v0.0.1 -* {String} +* {string} The file name of the current module. This is the resolved absolute path of the current module file. diff --git a/doc/api/http.md b/doc/api/http.md index 3d7174e909fbdb..02b7aa5cc9e7e7 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -463,7 +463,7 @@ aborted, in milliseconds since 1 January 1970 00:00:00 UTC. added: v0.1.90 --> -* `data` {string | Buffer} +* `data` {string|Buffer} * `encoding` {string} * `callback` {Function} @@ -531,7 +531,7 @@ Returns `request`. added: v0.1.29 --> -* `chunk` {string | Buffer} +* `chunk` {string|Buffer} * `encoding` {string} * `callback` {Function} @@ -895,7 +895,7 @@ will result in a [`TypeError`][] being thrown. added: v0.1.90 --> -* `data` {string | Buffer} +* `data` {string|Buffer} * `encoding` {string} * `callback` {Function} @@ -1080,7 +1080,7 @@ status message which was sent out. added: v0.1.29 --> -* `chunk` {string | Buffer} +* `chunk` {string|Buffer} * `encoding` {string} * `callback` {Function} * Returns: {Boolean} diff --git a/doc/api/modules.md b/doc/api/modules.md index 4eca72dd210c55..9621c72ccee0e4 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -586,7 +586,7 @@ function require(/* ... */) { added: v0.1.16 --> -* {String} +* {string} The fully resolved filename to the module. @@ -595,7 +595,7 @@ The fully resolved filename to the module. added: v0.1.16 --> -* {String} +* {string} The identifier for the module. Typically this is the fully resolved filename. @@ -605,7 +605,7 @@ filename. added: v0.1.16 --> -* {Boolean} +* {boolean} Whether or not the module is done loading, or is in the process of loading. diff --git a/doc/api/os.md b/doc/api/os.md index 318ea8d76cda3a..d14cd1b770e3db 100644 --- a/doc/api/os.md +++ b/doc/api/os.md @@ -14,7 +14,7 @@ const os = require('os'); added: v0.7.8 --> -* {String} +* {string} A string constant defining the operating system-specific end-of-line marker: @@ -26,7 +26,7 @@ A string constant defining the operating system-specific end-of-line marker: added: v0.5.0 --> -* Returns: {String} +* Returns: {string} The `os.arch()` method returns a string identifying the operating system CPU architecture *for which the Node.js binary was compiled*. @@ -172,7 +172,7 @@ all processors are always 0. added: v0.9.4 --> -* Returns: {String} +* Returns: {string} The `os.endianness()` method returns a string identifying the endianness of the CPU *for which the Node.js binary was compiled*. @@ -187,7 +187,7 @@ Possible values are: added: v0.3.3 --> -* Returns: {Integer} +* Returns: {integer} The `os.freemem()` method returns the amount of free system memory in bytes as an integer. @@ -197,7 +197,7 @@ an integer. added: v2.3.0 --> -* Returns: {String} +* Returns: {string} The `os.homedir()` method returns the home directory of the current user as a string. @@ -207,7 +207,7 @@ string. added: v0.3.3 --> -* Returns: {String} +* Returns: {string} The `os.hostname()` method returns the hostname of the operating system as a string. @@ -295,7 +295,7 @@ The properties available on the assigned network address object include: added: v0.5.0 --> -* Returns: {String} +* Returns: {string} The `os.platform()` method returns a string identifying the operating system platform as set during compile time of Node.js. @@ -321,7 +321,7 @@ to be experimental at this time. added: v0.3.3 --> -* Returns: {String} +* Returns: {string} The `os.release()` method returns a string identifying the operating system release. @@ -335,7 +335,7 @@ https://en.wikipedia.org/wiki/Uname#Examples for more information. added: v0.9.9 --> -* Returns: {String} +* Returns: {string} The `os.tmpdir()` method returns a string specifying the operating system's default directory for temporary files. @@ -345,7 +345,7 @@ default directory for temporary files. added: v0.3.3 --> -* Returns: {Integer} +* Returns: {integer} The `os.totalmem()` method returns the total amount of system memory in bytes as an integer. @@ -355,7 +355,7 @@ as an integer. added: v0.3.3 --> -* Returns: {String} +* Returns: {string} The `os.type()` method returns a string identifying the operating system name as returned by uname(3). For example `'Linux'` on Linux, `'Darwin'` on macOS and @@ -369,7 +369,7 @@ information about the output of running uname(3) on various operating systems. added: v0.3.3 --> -* Returns: {Integer} +* Returns: {integer} The `os.uptime()` method returns the system uptime in number of seconds. diff --git a/doc/api/path.md b/doc/api/path.md index c8fdff46a76d5f..a44bacb4657c10 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -61,7 +61,7 @@ added: v0.1.25 * `path` {string} * `ext` {string} An optional file extension -* Returns: {String} +* Returns: {string} The `path.basename()` methods returns the last portion of a `path`, similar to the Unix `basename` command. Trailing directory separators are ignored, see @@ -85,7 +85,7 @@ and is not a string. added: v0.9.3 --> -* {String} +* {string} Provides the platform-specific path delimiter: @@ -118,7 +118,7 @@ added: v0.1.16 --> * `path` {string} -* Returns: {String} +* Returns: {string} The `path.dirname()` method returns the directory name of a `path`, similar to the Unix `dirname` command. Trailing directory separators are ignored, see @@ -139,7 +139,7 @@ added: v0.1.25 --> * `path` {string} -* Returns: {String} +* Returns: {string} The `path.extname()` method returns the extension of the `path`, from the last occurrence of the `.` (period) character to end of string in the last portion of @@ -179,7 +179,7 @@ added: v0.11.15 * `base` {string} * `name` {string} * `ext` {string} -* Returns: {String} +* Returns: {string} The `path.format()` method returns a path string from an object. This is the opposite of [`path.parse()`][]. @@ -238,7 +238,7 @@ added: v0.11.2 --> * `path` {string} -* Returns: {Boolean} +* Returns: {boolean} The `path.isAbsolute()` method determines if `path` is an absolute path. @@ -273,7 +273,7 @@ added: v0.1.16 --> * `...paths` {string} A sequence of path segments -* Returns: {String} +* Returns: {string} The `path.join()` method joins all given `path` segments together using the platform specific separator as a delimiter, then normalizes the resulting path. @@ -300,7 +300,7 @@ added: v0.1.23 --> * `path` {string} -* Returns: {String} +* Returns: {string} The `path.normalize()` method normalizes the given `path`, resolving `'..'` and `'.'` segments. @@ -415,7 +415,7 @@ added: v0.5.0 * `from` {string} * `to` {string} -* Returns: {String} +* Returns: {string} The `path.relative()` method returns the relative path from `from` to `to`. If `from` and `to` each resolve to the same path (after calling `path.resolve()` @@ -446,7 +446,7 @@ added: v0.3.4 --> * `...paths` {string} A sequence of paths or path segments -* Returns: {String} +* Returns: {string} The `path.resolve()` method resolves a sequence of paths or path segments into an absolute path. @@ -488,7 +488,7 @@ A [`TypeError`][] is thrown if any of the arguments is not a string. added: v0.7.9 --> -* {String} +* {string} Provides the platform-specific path segment separator: diff --git a/doc/api/process.md b/doc/api/process.md index 6a1a779ddddf9d..70156972cb90b1 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -447,7 +447,7 @@ generate a core file. added: v0.5.0 --> -* {String} +* {string} The `process.arch` property returns a String identifying the processor architecture that the Node.js process is currently running on. For instance @@ -501,7 +501,7 @@ Would generate the output: added: 6.4.0 --> -* {String} +* {string} The `process.argv0` property stores a read-only copy of the original value of `argv[0]` passed when Node.js starts. @@ -586,7 +586,7 @@ replace the value of `process.config`. added: v0.7.2 --> -* {Boolean} +* {boolean} If the Node.js process is spawned with an IPC channel (see the [Child Process][] and [Cluster][] documentation), the `process.connected` property will return @@ -604,8 +604,8 @@ added: v6.1.0 * `previousValue` {Object} A previous return value from calling `process.cpuUsage()` * Returns: {Object} - * `user` {Integer} - * `system` {Integer} + * `user` {integer} + * `system` {integer} The `process.cpuUsage()` method returns the user and system CPU time usage of the current process, in an object with properties `user` and `system`, whose @@ -633,7 +633,7 @@ console.log(process.cpuUsage(startUsage)); added: v0.1.8 --> -* Returns: {String} +* Returns: {string} The `process.cwd()` method returns the current working directory of the Node.js process. @@ -861,7 +861,7 @@ And `process.argv`: added: v0.1.100 --> -* {String} +* {string} The `process.execPath` property returns the absolute pathname of the executable that started the Node.js process. @@ -878,7 +878,7 @@ For example: added: v0.1.13 --> -* `code` {Integer} The exit code. Defaults to `0`. +* `code` {integer} The exit code. Defaults to `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 @@ -943,7 +943,7 @@ is safer than calling `process.exit()`. added: v0.11.8 --> -* {Integer} +* {integer} A number which will be the process exit code, when the process either exits gracefully, or is exited via [`process.exit()`][] without specifying @@ -1028,7 +1028,7 @@ Android) added: v0.1.28 --> -* Returns: {Integer} +* Returns: {integer} The `process.getuid()` method returns the numeric user identity of the process. (See getuid(2).) @@ -1163,10 +1163,10 @@ added: v0.1.16 --> * Returns: {Object} - * `rss` {Integer} - * `heapTotal` {Integer} - * `heapUsed` {Integer} - * `external` {Integer} + * `rss` {integer} + * `heapTotal` {integer} + * `heapUsed` {integer} + * `external` {integer} The `process.memoryUsage()` method returns an object describing the memory usage of the Node.js process measured in bytes. @@ -1291,7 +1291,7 @@ happening, just like a `while(true);` loop. added: v0.1.15 --> -* {Integer} +* {integer} The `process.pid` property returns the PID of the process. @@ -1304,7 +1304,7 @@ console.log(`This process is pid ${process.pid}`); added: v0.1.16 --> -* {String} +* {string} The `process.platform` property returns a string identifying the operating system platform on which the Node.js process is running. For instance @@ -1335,7 +1335,7 @@ tarball. - `"Boron"` for the v6.x LTS line beginning with v6.9.0. * `sourceUrl` {string} an absolute URL pointing to a _`.tar.gz`_ file containing the source code of the current release. -* `headersUrl`{String} an absolute URL pointing to a _`.tar.gz`_ file containing +* `headersUrl`{string} an absolute URL pointing to a _`.tar.gz`_ file containing only the source header files for the current release. This file is significantly smaller than the full source file and can be used for compiling Node.js native add-ons. @@ -1371,7 +1371,7 @@ added: v0.5.9 * `sendHandle` {Handle object} * `options` {Object} * `callback` {Function} -* Returns: {Boolean} +* Returns: {boolean} If Node.js is spawned with an IPC channel, the `process.send()` method can be used to send messages to the parent process. Messages will be received as a @@ -1629,7 +1629,7 @@ See the [TTY][] documentation for more information. added: v0.1.104 --> -* {String} +* {string} The `process.title` property returns the current process title (i.e. returns the current value of `ps`). Assigning a new value to `process.title` modifies @@ -1670,7 +1670,7 @@ console.log( added: v0.5.0 --> -* Returns: {Number} +* Returns: {number} The `process.uptime()` method returns the number of seconds the current Node.js process has been running. @@ -1680,7 +1680,7 @@ process has been running. added: v0.1.3 --> -* {String} +* {string} The `process.version` property returns the Node.js version string. diff --git a/doc/api/repl.md b/doc/api/repl.md index 27b5b9aa392ab2..248d87991bb8ff 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -371,7 +371,7 @@ within the action function for commands registered using the added: v0.1.91 --> -* `options` {Object | String} +* `options` {Object | string} * `prompt` {string} The input prompt to display. Defaults to `> `. * `input` {Readable} The Readable stream from which REPL input will be read. Defaults to `process.stdin`. diff --git a/doc/api/stream.md b/doc/api/stream.md index e74cb327ce0239..6464d453840d13 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -434,7 +434,7 @@ added: v0.9.4 * `chunk` {string|Buffer} The data to write * `encoding` {string} The encoding, if `chunk` is a String * `callback` {Function} Callback for when this chunk of data is flushed -* Returns: {Boolean} `false` if the stream wishes for the calling code to +* Returns: {boolean} `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. @@ -732,7 +732,7 @@ preferred over the use of the `'readable'` event. added: v0.11.14 --> -* Returns: {Boolean} +* Returns: {boolean} The `readable.isPaused()` method returns the current operating state of the Readable. This is used primarily by the mechanism that underlies the @@ -837,7 +837,7 @@ added: v0.9.4 --> * `size` {number} Optional argument to specify how much data to read. -* Return {String|Buffer|null} +* Return {string|Buffer|null} The `readable.read()` method pulls some data out of the internal buffer and returns it. If no data available to be read, `null` is returned. By default, @@ -1486,7 +1486,7 @@ user programs. * `chunk` {Buffer|null|string} Chunk of data to push into the read queue * `encoding` {string} Encoding of String chunks. Must be a valid Buffer encoding, such as `'utf8'` or `'ascii'` -* Returns {Boolean} `true` if additional chunks of data may continued to be +* Returns {boolean} `true` if additional chunks of data may continued to be pushed; `false` otherwise. When `chunk` is a `Buffer` or `string`, the `chunk` of data will be added to the diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js index 96fdaf16e99461..3f1ea9597c4fbe 100644 --- a/tools/doc/type-parser.js +++ b/tools/doc/type-parser.js @@ -5,12 +5,13 @@ const jsDocUrl = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/' + const jsPrimitiveUrl = 'https://developer.mozilla.org/en-US/docs/Web/' + 'JavaScript/Data_structures'; const jsPrimitives = { - 'integer': 'Number', // this is for extending - 'number': 'Number', - 'string': 'String', 'boolean': 'Boolean', + 'integer': 'Number', // not a primitive, used for clarification 'null': 'Null', - 'symbol': 'Symbol' + 'number': 'Number', + 'string': 'String', + 'symbol': 'Symbol', + 'undefined': 'Undefined' }; const jsGlobalTypes = [ 'Error', 'Object', 'Function', 'Array', 'TypedArray', 'Uint8Array',