Skip to content

Commit

Permalink
升级到 v8.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
h7lin committed Jun 16, 2017
1 parent e0af064 commit 03e9296
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 30 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# node-api-cn
Node.js API 中文文档 v8.1.0
Node.js API 中文文档 v8.1.1

http://nodejs.cn/api/
4 changes: 3 additions & 1 deletion child_process/child_process_exec_command_options_callback.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ const defaults = {
注意:不像 POSIX 系统调用中的 exec(3)`child_process.exec()` 不会替换现有的进程,且使用一个 shell 来执行命令。

If this method is invoked as its [`util.promisify()`][]ed version, it returns
a Promise for an object with `stdout` and `stderr` properties.
a Promise for an object with `stdout` and `stderr` properties. In case of an
error, a rejected promise is returned, with the same `error` object given in the
callback, but with an additional two properties `stdout` and `stderr`.

For example:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ const child = execFile('node', ['--version'], (error, stdout, stderr) => {
如果 `encoding` `'buffer'`、或一个无法识别的字符编码,则传入 `Buffer` 对象到回调函数。

If this method is invoked as its [`util.promisify()`][]ed version, it returns
a Promise for an object with `stdout` and `stderr` properties.
a Promise for an object with `stdout` and `stderr` properties. In case of an
error, a rejected promise is returned, with the same `error` object given in the
callback, but with an additional two properties `stdout` and `stderr`.

```js
const util = require('util');
Expand Down
7 changes: 7 additions & 0 deletions fs/fs_access_path_mode_callback.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ changes:
pr-url: https://github.com/nodejs/node/pull/10739
description: The `path` parameter can be a WHATWG `URL` object using `file:`
protocol. Support is currently still *experimental*.
- version: v6.3.0
pr-url: https://github.com/nodejs/node/pull/6534
description: The constants like `fs.R_OK`, etc which were present directly
on `fs` were moved into `fs.constants` as a soft deprecation.
Thus for Node `< v6.3.0` use `fs` to access those constants, or
do something like `(fs.constants || fs).R_OK` to work with all
versions.
-->

* `path` {string|Buffer|URL}
Expand Down
2 changes: 1 addition & 1 deletion fs/fs_readfile_path_options_callback.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ changes:
description: 当成功时,`callback` 被调用时会带上 `null` 作为 `error` 参数的值。
- version: v5.0.0
pr-url: https://github.com/nodejs/node/pull/3163
description: 参数 `file` 可以是一个文件描述符。
description: 参数 `path` 可以是一个文件描述符。
-->

* `path` {string|Buffer|URL|integer} 文件名或文件描述符。
Expand Down
6 changes: 3 additions & 3 deletions fs/fs_readfilesync_path_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ changes:
protocol. Support is currently still *experimental*.
- version: v5.0.0
pr-url: https://github.com/nodejs/node/pull/3163
description: The `file` parameter can be a file descriptor now.
description: The `path` parameter can be a file descriptor now.
-->

* `path` {string|Buffer|URL|integer} 文件名或文件描述符
* `options` {Object|string}
* `encoding` {string|null} 默认 = `null`
* `flag` {string} 默认 = `'r'`

[`fs.readFile`] 的同步版本。
返回 `file` 的内容。
[`fs.readFile()`] 的同步版本。
返回 `path` 的内容。

如果指定了 `encoding` 选项,则该函数返回一个字符串,否则返回一个 buffer。

Expand Down
4 changes: 3 additions & 1 deletion n-api/napi_create_error.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
added: v8.0.0
-->
```C
NODE_EXTERN napi_status napi_create_error(napi_env env, const char* msg);
NODE_EXTERN napi_status napi_create_error(napi_env env,
const char* msg,
napi_value* result);
```
- `[in] env`: The environment that the API is invoked under.
- `[in] msg`: C string representing the text to be associated with.
Expand Down
4 changes: 3 additions & 1 deletion n-api/napi_create_range_error.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
added: v8.0.0
-->
```C
NODE_EXTERN napi_status napi_create_range_error(napi_env env, const char* msg);
NODE_EXTERN napi_status napi_create_range_error(napi_env env,
const char* msg,
napi_value* result);
```
- `[in] env`: The environment that the API is invoked under.
- `[in] msg`: C string representing the text to be associated with.
Expand Down
4 changes: 3 additions & 1 deletion n-api/napi_create_type_error.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
added: v8.0.0
-->
```C
NODE_EXTERN napi_status napi_create_type_error(napi_env env, const char* msg);
NODE_EXTERN napi_status napi_create_type_error(napi_env env,
const char* msg,
napi_value* result);
```
- `[in] env`: The environment that the API is invoked under.
- `[in] msg`: C string representing the text to be associated with.
Expand Down
35 changes: 18 additions & 17 deletions n-api/napi_property_attributes.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
```C
typedef enum {
napi_default = 0,
napi_read_only = 1 << 0,
napi_dont_enum = 1 << 1,
napi_dont_delete = 1 << 2,
napi_static_property = 1 << 10,
napi_writable = 1 << 0,
napi_enumerable = 1 << 1,
napi_configurable = 1 << 2,
// Used with napi_define_class to distinguish static properties
// from instance properties. Ignored by napi_define_properties.
napi_static = 1 << 10,
} napi_property_attributes;
```

`napi_property_attributes` are flags used to control the behavior of properties
set on a JavaScript object. They roughly correspond to the attributes listed in
[Section 6.1.7.1](https://tc39.github.io/ecma262/#table-2) of the
[ECMAScript Language Specification](https://tc39.github.io/ecma262/). They can
be one or more of the following bitflags:
set on a JavaScript object. Other than `napi_static` they correspond to the
attributes listed in [Section 6.1.7.1](https://tc39.github.io/ecma262/#table-2)
of the [ECMAScript Language Specification](https://tc39.github.io/ecma262/).
They can be one or more of the following bitflags:

- `napi_default` - Used to indicate that no explicit attributes are set on the
given property. By default, a property is Writable, Enumerable, and
Configurable. This is a deviation from the ECMAScript specification,
where generally the values for a property descriptor attribute default to
false if they're not provided.
- `napi_read_only` - Used to indicate that a given property is not Writable.
- `napi_dont_enum` - Used to indicate that a given property is not Enumerable.
- `napi_dont_delete` - Used to indicate that a given property is not.
Configurable, as defined in
given property. By default, a property is read only, not enumerable and not
configurable.
- `napi_writable` - Used to indicate that a given property is writable.
- `napi_enumerable` - Used to indicate that a given property is enumerable.
- `napi_configurable` - Used to indicate that a given property is
configurable, as defined in
[Section 6.1.7.1](https://tc39.github.io/ecma262/#table-2) of the
[ECMAScript Language Specification](https://tc39.github.io/ecma262/).
- `napi_static_property` - Used to indicate that the property will be defined as
- `napi_static` - Used to indicate that the property will be defined as
a static property on a class as opposed to an instance property, which is the
default. This is used only by [`napi_define_class`][]. It is ignored by
`napi_define_properties`.
Expand Down
9 changes: 8 additions & 1 deletion n-api/napi_property_descriptor.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
```C
typedef struct {
// One of utf8name or name should be NULL.
const char* utf8name;
napi_value name;
napi_callback method;
napi_callback getter;
Expand All @@ -12,7 +14,12 @@ typedef struct {
} napi_property_descriptor;
```

- `utf8name`: String describing the key for the property, encoded as UTF8.
- `utf8name`: Optional String describing the key for the property,
encoded as UTF8. One of `utf8name` or `name` must be provided for the
property.
- `name`: Optional napi_value that points to a JavaScript string or symbol
to be used as the key for the property. One of `utf8name` or `name` must
be provided for the property.
- `value`: The value that's retrieved by a get access of the property if the
property is a data property. If this is passed in, set `getter`, `setter`,
`method` and `data` to `NULL` (since these members won't be used).
Expand Down
4 changes: 4 additions & 0 deletions readline/readline_emitkeypressevents_stream_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ added: v0.7.7

如果 `stream` 是一个 [TTY],则它必须为原始模式。

*Note*: This is automatically called by any readline instance on its `input`
if the `input` is a terminal. Closing the `readline` instance does not stop
the `input` from emitting `'keypress'` events.

```js
readline.emitKeypressEvents(process.stdin);
if (process.stdin.isTTY)
Expand Down
4 changes: 2 additions & 2 deletions tls/tls_createserver_options_secureconnectionlistener.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ changes:
* `options` {Object}
* `handshakeTimeout` {number} Abort the connection if the SSL/TLS handshake
does not finish in the specified number of milliseconds. Defaults to `120`
seconds. A `'clientError'` is emitted on the `tls.Server` object whenever a
handshake times out.
seconds. A `'tlsClientError'` is emitted on the `tls.Server` object whenever
a handshake times out.
* `requestCert` {boolean} If `true` the server will request a certificate from
clients that connect and attempt to verify that certificate. Defaults to
`false`.
Expand Down

0 comments on commit 03e9296

Please sign in to comment.