Skip to content

Commit

Permalink
feat: 14.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
h7lin committed Sep 24, 2020
1 parent 3d84af8 commit 0e01c4b
Show file tree
Hide file tree
Showing 66 changed files with 352 additions and 110 deletions.
4 changes: 2 additions & 2 deletions async_hooks/troubleshooting.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

In most cases your application or library code should have no issues with
`AsyncLocalStorage`. But in rare cases you may face situations when the
current store is lost in one of asynchronous operations. Then you should
current store is lost in one of asynchronous operations. In those cases,
consider the following options.
If your code is callback-based, it is enough to promisify it with
[`util.promisify()`][], so it starts working with native promises.
If you need to keep using callback-based API, or your code assumes
a custom thenable implementation, you should use [`AsyncResource`][] class
a custom thenable implementation, use the [`AsyncResource`][] class
to associate the asynchronous operation with the correct execution context.


Expand Down
2 changes: 1 addition & 1 deletion child_process/subprocess_spawnargs.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

* {Array}

The `subprocess.spawnargs` property represents the full list of command line
The `subprocess.spawnargs` property represents the full list of command-line
arguments the child process was launched with.

2 changes: 1 addition & 1 deletion cli/.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ added: v8.0.0
-->

stdin 的别名。
类似于在其他命令行工具中使用 `-`这意味着将会从 stdin 读取脚本,且其余的选项会传给该脚本。
类似于在其他命令行工具中使用 `-`这意味着从 stdin 读取脚本,且其余的选项会传给该脚本。

2 changes: 1 addition & 1 deletion cli/1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ added: v6.11.0

指示 node 选项的结束。
其余的参数会被传给脚本。
如果在此之前没有提供脚本的文件名或 eval/print 脚本,则下一个参数将会被用作脚本的文件名
如果在此之前没有提供脚本的文件名或 eval/print 脚本,则下一个参数会被用作脚本的文件名

4 changes: 2 additions & 2 deletions cli/cpu_prof.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ added: v12.0.0
Starts the V8 CPU profiler on start up, and writes the CPU profile to disk
before exit.

If `--cpu-prof-dir` is not specified, the generated profile will be placed
If `--cpu-prof-dir` is not specified, the generated profile is placed
in the current working directory.

If `--cpu-prof-name` is not specified, the generated profile will be
If `--cpu-prof-name` is not specified, the generated profile is
named `CPU.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.cpuprofile`.

```console
Expand Down
2 changes: 1 addition & 1 deletion cli/cpu_prof_dir.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Specify the directory where the CPU profiles generated by `--cpu-prof` will
be placed.

The default value is controlled by the
[--diagnostic-dir](#cli_diagnostic_dir_directory) command line option.
[--diagnostic-dir](#cli_diagnostic_dir_directory) command-line option.

2 changes: 1 addition & 1 deletion cli/diagnostic_dir_directory.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Set the directory to which all diagnostic output files will be written to.
Set the directory to which all diagnostic output files are written.
Defaults to current working directory.

Affects the default output directory of:
Expand Down
4 changes: 2 additions & 2 deletions cli/disable_proto_mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ added: v13.12.0
-->

Disable the `Object.prototype.__proto__` property. If `mode` is `delete`, the
property will be removed entirely. If `mode` is `throw`, accesses to the
property will throw an exception with the code `ERR_PROTO_ACCESS`.
property is removed entirely. If `mode` is `throw`, accesses to the
property throw an exception with the code `ERR_PROTO_ACCESS`.

4 changes: 2 additions & 2 deletions cli/experimental_specifier_resolution_mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Sets the resolution algorithm for resolving ES module specifiers. Valid options
are `explicit` and `node`.

The default is `explicit`, which requires providing the full path to a
module. The `node` mode will enable support for optional file extensions and
module. The `node` mode enables support for optional file extensions and
the ability to import a directory that has an index file.

Please see [customizing ESM specifier resolution][] for example usage.
See [customizing ESM specifier resolution][] for example usage.

4 changes: 2 additions & 2 deletions cli/heap_prof.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ added: v12.4.0
Starts the V8 heap profiler on start up, and writes the heap profile to disk
before exit.

If `--heap-prof-dir` is not specified, the generated profile will be placed
If `--heap-prof-dir` is not specified, the generated profile is placed
in the current working directory.

If `--heap-prof-name` is not specified, the generated profile will be
If `--heap-prof-name` is not specified, the generated profile is
named `Heap.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.heapprofile`.

```console
Expand Down
2 changes: 1 addition & 1 deletion cli/heap_prof_dir.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Specify the directory where the heap profiles generated by `--heap-prof` will
be placed.

The default value is controlled by the
[--diagnostic-dir](#cli_diagnostic_dir_directory) command line option.
[--diagnostic-dir](#cli_diagnostic_dir_directory) command-line option.

1 change: 1 addition & 0 deletions cli/max_old_space_size_size_in_megabytes.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ $ node --max-old-space-size=1536 index.js






11 changes: 5 additions & 6 deletions cli/node_options_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
added: v8.0.0
-->

A space-separated list of command line options. `options...` are interpreted
before command line options, so command line options will override or
A space-separated list of command-line options. `options...` are interpreted
before command-line options, so command-line options will override or
compound after anything in `options...`. Node.js will exit with an error if
an option that is not allowed in the environment is used, such as `-p` or a
script file.

In case an option value happens to contain a space (for example a path listed
in `--require`), it must be escaped using double quotes. For example:
If an option value contains a space, it can be escaped using double quotes:

```bash
NODE_OPTIONS='--require "./my path/file.js"'
```

A singleton flag passed as a command line option will override the same flag
A singleton flag passed as a command-line option will override the same flag
passed into `NODE_OPTIONS`:

```bash
Expand All @@ -24,7 +23,7 @@ NODE_OPTIONS='--inspect=localhost:4444' node --inspect=localhost:5555
```

A flag that can be passed multiple times will be treated as if its
`NODE_OPTIONS` instances were passed first, and then its command line
`NODE_OPTIONS` instances were passed first, and then its command-line
instances afterwards:

```bash
Expand Down
2 changes: 1 addition & 1 deletion cli/node_pending_deprecation_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ When set to `1`, emit pending deprecation warnings.

Pending deprecations are generally identical to a runtime deprecation with the
notable exception that they are turned *off* by default and will not be emitted
unless either the `--pending-deprecation` command line flag, or the
unless either the `--pending-deprecation` command-line flag, or the
`NODE_PENDING_DEPRECATION=1` environment variable, is set. Pending deprecations
are used to provide a kind of selective "early warning" mechanism that
developers may leverage to detect deprecated API usage.
Expand Down
2 changes: 1 addition & 1 deletion cli/openssl_conf_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Load an OpenSSL configuration file on startup. Among other uses, this can be
used to enable FIPS-compliant crypto if Node.js is built with `./configure
--openssl-fips`.

If the [`--openssl-config`][] command line option is used, the environment
If the [`--openssl-config`][] command-line option is used, the environment
variable is ignored.

7 changes: 5 additions & 2 deletions cli/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ changes:
-->

所有选项(包括 V8 选项)都允许单词用短划线(`-`)或下划线(`_`)分隔。
例如,`--pending-deprecation` 等效于 `--pending_deprecation`

例如,`--pending-deprecation` 等同于 `--pending_deprecation`

If an option that takes a single value (such as `--max-http-header-size`) is
passed more than once, then the last passed value is used. Options from the
command line take precedence over options passed through the [`NODE_OPTIONS`][]
environment variable.

2 changes: 1 addition & 1 deletion cli/pending_deprecation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Emit pending deprecation warnings.

Pending deprecations are generally identical to a runtime deprecation with the
notable exception that they are turned *off* by default and will not be emitted
unless either the `--pending-deprecation` command line flag, or the
unless either the `--pending-deprecation` command-line flag, or the
`NODE_PENDING_DEPRECATION=1` environment variable, is set. Pending deprecations
are used to provide a kind of selective "early warning" mechanism that
developers may leverage to detect deprecated API usage.
Expand Down
4 changes: 2 additions & 2 deletions cli/preserve_symlinks_main.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ This flag exists so that the main module can be opted-in to the same behavior
that `--preserve-symlinks` gives to all other imports; they are separate flags,
however, for backward compatibility with older Node.js versions.

`--preserve-symlinks-main` does not imply `--preserve-symlinks`; it
is expected that `--preserve-symlinks-main` will be used in addition to
`--preserve-symlinks-main` does not imply `--preserve-symlinks`; use
`--preserve-symlinks-main` in addition to
`--preserve-symlinks` when it is not desirable to follow symlinks before
resolving relative paths.

Expand Down
2 changes: 1 addition & 1 deletion cli/redirect_warnings_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ warning will be written to stderr instead.

The `file` name may be an absolute path. If it is not, the default directory it
will be written to is controlled by the
[--diagnostic-dir](#cli_diagnostic_dir_directory) command line option.
[--diagnostic-dir](#cli_diagnostic_dir_directory) command-line option.

2 changes: 1 addition & 1 deletion crypto/crypto_default_encoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The default encoding to use for functions that can take either strings
or [buffers][`Buffer`]. The default value is `'buffer'`, which makes methods
default to [`Buffer`][] objects.

The `crypto.DEFAULT_ENCODING` mechanism is provided for backwards compatibility
The `crypto.DEFAULT_ENCODING` mechanism is provided for backward compatibility
with legacy programs that expect `'latin1'` to be the default encoding.

New applications should expect the default to be `'buffer'`.
Expand Down
2 changes: 1 addition & 1 deletion deprecations/dep0089_require_assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ Type: Deprecation revoked

Importing assert directly was not recommended as the exposed functions use
loose equality checks. The deprecation was revoked because use of the `assert`
module is not discouraged, and the deprecation caused end user confusion.
module is not discouraged, and the deprecation caused developer confusion.

10 changes: 5 additions & 5 deletions dgram/note_about_udp_datagram_size.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

`IPv4/v6` 数据包的最大尺寸取决于 `MTU`(Maximum Transmission Unit,最大传输单元) `Payload Length` 字段大小。
IPv4/v6 数据包的最大尺寸取决于 `MTU`(Maximum Transmission Unit,最大传输单元) `Payload Length` 字段大小。

- `Payload Length` 字段有 `16 位` 宽,指一个超过 64K 的包含 IP 头部和数据的负载 (65,507 字节 = 65,535 8 字节 UDP 20 字节 IP )
- `Payload Length` 字段有 16 位宽,这意味着不能超过 64K 的包含 IP 头部和数据的负载 (65,507 字节 = 65,535 8 字节 UDP 20 字节 IP )
通常对于环回地址来说是这样,但这个长度的数据包对于大多数的主机和网络来说不切实际。

- `MTU` 指的是数据链路层为数据包提供的最大大小。
对于任意链路,`IPv4` 所托管的 `MTU` 最小为 `68` 个字节,推荐为 `576`(典型地,作为拨号上网应用的推荐值),无论它们是完整地还是分块地抵达。
对于任意链路,IPv4 所托管的 `MTU` 最小为 68 个字节,推荐为 576(典型地,作为拨号上网应用的推荐值),无论它们是完整地还是分块地抵达。

对于 `IPv6``MTU` 的最小值是 `1280` 个字节,然而,受托管的最小的碎片重组缓冲大小为 `1500` 个字节。
现今大多数的数据链路层技术(如以太网),都有 `1500` `MTU` 最小值,因而 `68` 个字节显得非常小。
对于 IPv6,`MTU` 的最小值是 1280 个字节。但是,受托管的最小的碎片重组缓冲大小为 1500 个字节。
现今大多数的数据链路层技术(如以太网),都有 1500 `MTU` 最小值,因而 68 个字节显得非常小。

要提前知道数据包可能经过的每个链路的 MTU 是不可能的。
发送大于接受者 `MTU` 大小的数据包将不会起作用,因为数据包会被静默地丢失,而不会通知发送者该包未抵达目的地。
Expand Down
2 changes: 1 addition & 1 deletion documentation/stability_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
> npm 生态系统的兼容性是最高的优先级。

在使用实验的特性时必须谨慎,特别是在模块中。
终端用户可能不知道正在使用实验的特性
用户可能不知道正在使用实验的特性
当实验的 API 发生修改时,可能会出现意外的故障或行为的改变。
为了避免此类意外,使用实验的特性可能需要命令行标志。
实验的特性也可能触发[警告][warning]
Expand Down
3 changes: 2 additions & 1 deletion domain/domain.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!-- YAML
deprecated: v1.4.2
changes:
- version: v8.8.0
description: Any `Promise`s created in VM contexts no longer have a
Expand All @@ -18,7 +19,7 @@ changes:
<!-- source_link=lib/domain.js -->

**This module is pending deprecation**. Once a replacement API has been
finalized, this module will be fully deprecated. Most end users should
finalized, this module will be fully deprecated. Most developers should
**not** have cause to use this module. Users who absolutely must have
the functionality that domains provide may rely on it for the time being
but should expect to have to migrate to a different solution
Expand Down
2 changes: 1 addition & 1 deletion errors/err_invalid_package_config.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

An invalid `package.json` file was found which failed parsing.
An invalid `package.json` file failed parsing.

<a id="ERR_INVALID_PACKAGE_TARGET"></a>
4 changes: 2 additions & 2 deletions errors/err_missing_message_port_in_transfer_list.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

An object that needs to be explicitly listed in the `transferList` argument
was found in the object passed to a `postMessage()` call, but not provided in
the `transferList` for that call. Usually, this is a `MessagePort`.
is in the object passed to a `postMessage()` call, but is not provided
in the `transferList` for that call. Usually, this is a `MessagePort`.

<a id="ERR_MISSING_PASSPHRASE"></a>
2 changes: 1 addition & 1 deletion errors/err_valid_performance_entry_type.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

While using the Performance Timing API (`perf_hooks`), no valid performance
entry types were found.
entry types are found.

<a id="ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING"></a>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ myObject.stack; // 类似 `new Error().stack`
可选的 `constructorOpt` 参数接受一个函数。
如果提供了,则 `constructorOpt` 之上包括自身在内的全部栈帧都会被生成的堆栈跟踪省略。

`constructorOpt` 参数用在向最终用户隐藏错误生成的具体细节时非常有用。例如:
`constructorOpt` 参数用在向用户隐藏错误生成的具体细节时非常有用。例如:


```js
Expand Down
2 changes: 1 addition & 1 deletion events/eventemitter_defaultmaxlisteners.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ added: v0.11.2
默认情况下,每个事件可以注册最多 `10` 个监听器。
可以使用 [`emitter.setMaxListeners(n)`] 方法改变单个 `EventEmitter` 实例的限制。
可以使用 `EventEmitter.defaultMaxListeners` 属性改变所有 `EventEmitter` 实例的默认值。
如果此值不是一个正数,则抛出 `TypeError`
如果此值不是一个正数,则抛出 `RangeError`

设置 `EventEmitter.defaultMaxListeners` 要谨慎,因为会影响所有 `EventEmitter` 实例,包括之前创建的。
因而,优先使用 [`emitter.setMaxListeners(n)`] 而不是 `EventEmitter.defaultMaxListeners`
Expand Down
2 changes: 1 addition & 1 deletion events/eventemitter_listenercount_emitter_eventname.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- YAML
added: v0.9.12
deprecated: v4.0.0
deprecated: v3.2.0
-->

> Stability: 0 - Deprecated: Use [`emitter.listenerCount()`][] instead.
Expand Down
7 changes: 6 additions & 1 deletion fs/filehandle_write_buffer_offset_length_position.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<!-- YAML
added: v10.0.0
changes:
- version: v14.12.0
pr-url: https://github.com/nodejs/node/pull/34993
description: The `buffer` parameter will stringify an object with an
explicit `toString` function.
- version: v14.0.0
pr-url: https://github.com/nodejs/node/pull/31030
description: The `buffer` parameter won't coerce unsupported input to
buffers anymore.
-->
* `buffer` {Buffer|Uint8Array}

* `buffer` {Buffer|Uint8Array|string|Object}
* `offset` {integer}
* `length` {integer}
* `position` {integer}
Expand Down
8 changes: 6 additions & 2 deletions fs/filehandle_write_string_position_encoding.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
<!-- YAML
added: v10.0.0
changes:
- version: v14.12.0
pr-url: https://github.com/nodejs/node/pull/34993
description: The `string` parameter will stringify an object with an
explicit `toString` function.
- version: v14.0.0
pr-url: https://github.com/nodejs/node/pull/31030
description: The `string` parameter won't coerce unsupported input to
strings anymore.
-->

* `string` {string}
* `string` {string|Object}
* `position` {integer}
* `encoding` {string} **默认值:** `'utf8'`
* 返回: {Promise}

`string` 写入到文件。
如果 `string` 不是一个字符串,则会抛出异常
如果 `string` 不是字符串或具有自有 `toString` 函数属性的对象,则抛出异常


`Promise` 会被解决并带上一个对象,对象包含一个 `bytesWritten` 属性(指定写入的字节数)和一个 `buffer` 属性(指向写入的 `string`)。
Expand Down
11 changes: 8 additions & 3 deletions fs/filehandle_writefile_data_options.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
<!-- YAML
added: v10.0.0
changes:
- version: v14.12.0
pr-url: https://github.com/nodejs/node/pull/34993
description: The `data` parameter will stringify an object with an
explicit `toString` function.
- version: v14.0.0
pr-url: https://github.com/nodejs/node/pull/31030
description: 参数 `data` 不再强制转换不支持的输入为字符串。
-->
* `data` {string|Buffer|Uint8Array}

* `data` {string|Buffer|Uint8Array|Object}
* `options` {Object|string}
* `encoding` {string|null} **默认值:** `'utf8'`
* 返回: {Promise}


异步地将数据写入到一个文件,如果文件已存在则覆盖该文件。
`data` 可以是字符串或 buffer。
`Promise` 将会在成功时解决,且不带参数。
`data` 可以是字符串、buffer、或具有自有 `toString` 函数属性的对象
`Promise` 会在成功时被解决,且不带参数。

如果 `data` buffer,则 `encoding` 选项会被忽略。

Expand Down
5 changes: 5 additions & 0 deletions fs/fs_copyfile_src_dest_mode_callback.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<!-- YAML
added: v8.5.0
changes:
- version: v14.0.0
pr-url: https://github.com/nodejs/node/pull/27044
description: Changed 'flags' argument to 'mode' and imposed
stricter type validation.
-->

* `src` {string|Buffer|URL} 要拷贝的源文件名。
Expand Down
Loading

0 comments on commit 0e01c4b

Please sign in to comment.