- assert 断言
- async_hooks 异步钩子
- async_hooks/context 异步上下文
- buffer 缓冲区
- C++插件
- C/C++插件(使用 Node-API)
- C++嵌入器
- child_process 子进程
- cluster 集群
- CLI 命令行
- console 控制台
- Corepack 核心包
- crypto 加密
- crypto/webcrypto 网络加密
- debugger 调试器
- deprecation 弃用
- dgram 数据报
- diagnostics_channel 诊断通道
- dns 域名服务器
- domain 域
- Error 错误
- events 事件触发器
- fs 文件系统
- global 全局变量
- http 超文本传输协议
- http2 超文本传输协议 2.0
- https 安全超文本传输协议
- inspector 检查器
- Intl 国际化
- module 模块
- module/cjs CommonJS 模块
- module/esm ECMAScript 模块
- module/package 包模块
- net 网络
- os 操作系统
- path 路径
- perf_hooks 性能钩子
- permission 权限
- process 进程
- punycode 域名代码
- querystring 查询字符串
- readline 逐行读取
- repl 交互式解释器
- report 诊断报告
- sea 单个可执行应用程序
- stream 流
- stream/web 网络流
- string_decoder 字符串解码器
- test 测试
- timers 定时器
- tls 安全传输层
- trace_events 跟踪事件
- tty 终端
- url 网址
- util 实用工具
- v8 引擎
- vm 虚拟机
- wasi 网络汇编系统接口
- worker_threads 工作线程
- zlib 压缩
Node.js v20.20.6 文档
- Node.js v20.20.6
- 目录
-
导航
- assert 断言
- async_hooks 异步钩子
- async_hooks/context 异步上下文
- buffer 缓冲区
- C++插件
- C/C++插件(使用 Node-API)
- C++嵌入器
- child_process 子进程
- cluster 集群
- CLI 命令行
- console 控制台
- Corepack 核心包
- crypto 加密
- crypto/webcrypto 网络加密
- debugger 调试器
- deprecation 弃用
- dgram 数据报
- diagnostics_channel 诊断通道
- dns 域名服务器
- domain 域
- Error 错误
- events 事件触发器
- fs 文件系统
- global 全局变量
- http 超文本传输协议
- http2 超文本传输协议 2.0
- https 安全超文本传输协议
- inspector 检查器
- Intl 国际化
- module 模块
- module/cjs CommonJS 模块
- module/esm ECMAScript 模块
- module/package 包模块
- net 网络
- os 操作系统
- path 路径
- perf_hooks 性能钩子
- permission 权限
- process 进程
- punycode 域名代码
- querystring 查询字符串
- readline 逐行读取
- repl 交互式解释器
- report 诊断报告
- sea 单个可执行应用程序
- stream 流
- stream/web 网络流
- string_decoder 字符串解码器
- test 测试
- timers 定时器
- tls 安全传输层
- trace_events 跟踪事件
- tty 终端
- url 网址
- util 实用工具
- v8 引擎
- vm 虚拟机
- wasi 网络汇编系统接口
- worker_threads 工作线程
- zlib 压缩
- 其他版本
关于本文档#>
【About this documentation】
欢迎使用 Node.js 的官方 API 参考文档!
【Welcome to the official API reference documentation for Node.js!】
Node.js 是一个基于 V8 JavaScript 引擎 构建的 JavaScript 运行时。
【Node.js is a JavaScript runtime built on the V8 JavaScript engine.】
贡献#>
【Contributing】
在 问题追踪器 中报告此文档的错误。有关如何提交拉取请求的说明,请参见 贡献指南。
【Report errors in this documentation in the issue tracker. See the contributing guide for directions on how to submit pull requests.】
稳定性指标#>
【Stability index】
在整个文档中都有关于各部分稳定性的说明。有些 API 已经经过充分验证并被广泛依赖,几乎不可能再发生任何改变。另一些则是全新且实验性的,或者已知存在风险。
【Throughout the documentation are indications of a section's stability. Some APIs are so proven and so relied upon that they are unlikely to ever change at all. Others are brand new and experimental, or known to be hazardous.】
稳定性指标如下:
【The stability indexes are as follows:】
实验性功能分为以下几个阶段:
- 1.0 - 早期开发阶段。此阶段的实验性功能尚未完成,可能会发生重大变更。
- 1.1 - 活跃开发阶段。此阶段的实验性功能接近最小可行性。
- 1.2 - 候选发布阶段。此阶段的实验性功能预计可以变为稳定功能。不预期再有破坏性更改,但可能会根据用户反馈进行调整。我们鼓励用户测试并提供反馈,以便我们确定该功能已准备好被标记为稳定。
实验性功能通常会通过以下方式结束实验状态:要么升级为稳定功能,要么在没有弃用周期的情况下被移除。
如果某些功能的使用没有造成伤害,并且在 npm 生态系统中被广泛依赖,它们会被标记为遗留功能,而不是被弃用。在遗留功能中发现的错误不太可能被修复。
【Features are marked as legacy rather than being deprecated if their use does no harm, and they are widely relied upon within the npm ecosystem. Bugs found in legacy features are unlikely to be fixed.】
在使用实验性功能时要小心,尤其是在编写库时。用户可能不知道使用了实验性功能。当实验性 API 发生修改时,可能会出现错误或行为变化,令用户感到意外。为了避免意外,使用实验性功能可能需要命令行标志。实验性功能也可能发出 警告。
【Use caution when making use of Experimental features, particularly when authoring libraries. Users may not be aware that experimental features are being used. Bugs or behavior changes may surprise users when Experimental API modifications occur. To avoid surprises, use of an Experimental feature may need a command-line flag. Experimental features may also emit a warning.】
稳定性概述#>
【Stability overview】
| API | 稳定性 |
|---|---|
| assert | (2) 稳定 |
| async_context | (2) 稳定 |
| async_hooks | (1) 实验 |
| buffer | (2) 稳定 |
| child_process | (2) 稳定 |
| cluster | (2) 稳定 |
| console | (2) 稳定 |
| corepack | (1) 实验 |
| crypto | (2) 稳定 |
| debugger | (2) 稳定 |
| dgram | (2) 稳定 |
| diagnostics_channel | (2) 稳定 |
| dns | (2) 稳定 |
| domain | (0) 弃用 |
| events | (2) 稳定 |
| fs | (2) 稳定 |
| http | (2) 稳定 |
| http2 | (2) 稳定 |
| https | (2) 稳定 |
| inspector | (2) 稳定 |
| modules | (2) 稳定 |
| n-api | (2) 稳定 |
| net | (2) 稳定 |
| os | (2) 稳定 |
| path | (2) 稳定 |
| perf_hooks | (2) 稳定 |
| policy | (1) 实验 |
| punycode | (0) 弃用 |
| querystring | (2) 稳定 |
| readline | (2) 稳定 |
| repl | (2) 稳定 |
| report | (2) 稳定 |
| single-executable-applications | (1.1) 活跃开发 |
| stream | (2) 稳定 |
| string_decoder | (2) 稳定 |
| test | (2) 稳定 |
| timers | (2) 稳定 |
| tls | (2) 稳定 |
| tracing | (1) 实验 |
| tty | (2) 稳定 |
| url | (2) 稳定 |
| util | (2) 稳定 |
| vm | (2) 稳定 |
| wasi | (1) 实验 |
| webstreams | (1) 实验 |
| worker_threads | (2) 稳定 |
| zlib | (2) 稳定 |
JSON 输出#>
【JSON output】
每个 .html 文档都有对应的 .json 文档。这是为 IDE 和其他使用文档的工具准备的。
【Every .html document has a corresponding .json document. This is for IDEs
and other utilities that consume the documentation.】
系统调用和手册页面#>
【System calls and man pages】
封装系统调用的 Node.js 函数会在文档中说明这一点。文档会链接到相应的手册页,描述系统调用的工作原理。
【Node.js functions which wrap a system call will document that. The docs link to the corresponding man pages which describe how the system call works.】
大多数 Unix 系统调用在 Windows 中有类似功能。不过,行为差异仍可能无法避免。
【Most Unix system calls have Windows analogues. Still, behavior differences may be unavoidable.】