Node.js v20.11.1 文档


弃用的 API#

¥Deprecated APIs

Node.js API 可能由于以下任何原因而被弃用:

¥Node.js APIs might be deprecated for any of the following reasons:

  • 该 API 的使用是不安全的。

    ¥Use of the API is unsafe.

  • 改进的替代 API 可用。

    ¥An improved alternative API is available.

  • 预计在未来的主要版本中会对 API 进行重大更改。

    ¥Breaking changes to the API are expected in a future major release.

Node.js 使用了三种弃用:

¥Node.js uses three kinds of Deprecations:

  • 仅文档

    ¥Documentation-only

  • 运行时

    ¥Runtime

  • 生命结束

    ¥End-of-Life

仅文档弃用是仅在 Node.js API 文档中表达的弃用。这些在运行 Node.js 时不会产生副作用。某些仅文档的弃用在使用 --pending-deprecation 标志(或其替代的 NODE_PENDING_DEPRECATION=1 环境变量)启动时会触发运行时警告,类似于下面的运行时弃用。支持该标志的仅文档弃用在 弃用的 API 列表 中明确标记为此类。

¥A Documentation-only deprecation is one that is expressed only within the Node.js API docs. These generate no side-effects while running Node.js. Some Documentation-only deprecations trigger a runtime warning when launched with --pending-deprecation flag (or its alternative, NODE_PENDING_DEPRECATION=1 environment variable), similarly to Runtime deprecations below. Documentation-only deprecations that support that flag are explicitly labeled as such in the list of Deprecated APIs.

默认情况下,运行时弃用将生成进程警告,该警告将在第一次使用弃用的 API 时打印到 stderr。当使用 --throw-deprecation 命令行标志时,运行时弃用将导致抛出错误。

¥A Runtime deprecation will, by default, generate a process warning that will be printed to stderr the first time the deprecated API is used. When the --throw-deprecation command-line flag is used, a Runtime deprecation will cause an error to be thrown.

当特性已经或即将从 Node.js 中删除时,使用生命结束的弃用。

¥An End-of-Life deprecation is used when functionality is or will soon be removed from Node.js.

撤销弃用#

¥Revoking deprecations

有时,API 的弃用可能会被逆转。在这种情况下,本文件将更新与决定相关的信息。但是,弃用标识符不会被修改。

¥Occasionally, the deprecation of an API might be reversed. In such situations, this document will be updated with information relevant to the decision. However, the deprecation identifier will not be modified.

已弃用的 API 列表#

¥List of deprecated APIs

DEP0001:http.OutgoingMessage.prototype.flush#

类型:生命结束

¥Type: End-of-Life

OutgoingMessage.prototype.flush() 已被删除。改用 OutgoingMessage.prototype.flushHeaders()

¥OutgoingMessage.prototype.flush() has been removed. Use OutgoingMessage.prototype.flushHeaders() instead.

DEP0002:require('_linklist')#

类型:生命结束

¥Type: End-of-Life

_linklist 模块已弃用。请使用用户空间替代方案。

¥The _linklist module is deprecated. Please use a userland alternative.

DEP0003:_writableState.buffer#

类型:生命结束

¥Type: End-of-Life

_writableState.buffer 已被移除。改用 _writableState.getBuffer()

¥The _writableState.buffer has been removed. Use _writableState.getBuffer() instead.

DEP0004:CryptoStream.prototype.readyState#

类型:生命结束

¥Type: End-of-Life

CryptoStream.prototype.readyState 属性已被删除。

¥The CryptoStream.prototype.readyState property was removed.

DEP0005:Buffer() 构造函数#

¥DEP0005: Buffer() constructor

类型:运行时(支持 --pending-deprecation

¥Type: Runtime (supports --pending-deprecation)

由于可能导致意外安全问题的 API 可用性问题,Buffer() 函数和 new Buffer() 构造函数已弃用。

¥The Buffer() function and new Buffer() constructor are deprecated due to API usability issues that can lead to accidental security issues.

作为替代方案,使用以下方法之一构造 Buffer 对象:

¥As an alternative, use one of the following methods of constructing Buffer objects:

如果没有 --pending-deprecation,运行时警告只会出现在不在 node_modules 中的代码中。这意味着在依赖中使用 Buffer() 不会有弃用警告。对于 --pending-deprecation,无论在何处使用 Buffer(),都会产生运行时警告。

¥Without --pending-deprecation, runtime warnings occur only for code not in node_modules. This means there will not be deprecation warnings for Buffer() usage in dependencies. With --pending-deprecation, a runtime warning results no matter where the Buffer() usage occurs.

DEP0006:child_process options.customFds#

类型:生命结束

¥Type: End-of-Life

child_process 模块的 spawn()fork()exec() 方法中,不推荐使用 options.customFds 选项。应该改用 options.stdio 选项。

¥Within the child_process module's spawn(), fork(), and exec() methods, the options.customFds option is deprecated. The options.stdio option should be used instead.

DEP0007:将 cluster worker.suicide 替换为 worker.exitedAfterDisconnect#

¥DEP0007: Replace cluster worker.suicide with worker.exitedAfterDisconnect

类型:生命结束

¥Type: End-of-Life

在早期版本的 Node.js cluster 中,名称为 suicide 的布尔属性被添加到 Worker 对象。此属性的目的是提供有关 Worker 实例退出的方式和原因的指示。在 Node.js 6.0.0 中,旧属性已弃用并替换为新的 worker.exitedAfterDisconnect 属性。旧的属性名称并没有准确描述实际的语义,而且不必要地充满了情感。

¥In an earlier version of the Node.js cluster, a boolean property with the name suicide was added to the Worker object. The intent of this property was to provide an indication of how and why the Worker instance exited. In Node.js 6.0.0, the old property was deprecated and replaced with a new worker.exitedAfterDisconnect property. The old property name did not precisely describe the actual semantics and was unnecessarily emotion-laden.

DEP0008:require('node:constants')#

类型:仅文档

¥Type: Documentation-only

node:constants 模块已弃用。当需要访问与特定 Node.js 内置模块相关的常量时,开发者应改为引用相关模块公开的 constants 属性。例如,require('node:fs').constantsrequire('node:os').constants

¥The node:constants module is deprecated. When requiring access to constants relevant to specific Node.js builtin modules, developers should instead refer to the constants property exposed by the relevant module. For instance, require('node:fs').constants and require('node:os').constants.

DEP0009:crypto.pbkdf2 无摘要#

¥DEP0009: crypto.pbkdf2 without digest

类型:生命结束

¥Type: End-of-Life

在 Node.js 6.0 中不推荐在不指定摘要的情况下使用 crypto.pbkdf2() API,因为该方法默认使用不推荐的 'SHA1' 摘要。以前,打印了弃用警告。从 Node.js 8.0.0 开始,调用 crypto.pbkdf2()crypto.pbkdf2Sync() 并将 digest 设置为 undefined 将抛出 TypeError

¥Use of the crypto.pbkdf2() API without specifying a digest was deprecated in Node.js 6.0 because the method defaulted to using the non-recommended 'SHA1' digest. Previously, a deprecation warning was printed. Starting in Node.js 8.0.0, calling crypto.pbkdf2() or crypto.pbkdf2Sync() with digest set to undefined will throw a TypeError.

从 Node.js v11.0.0 开始,在 digest 设置为 null 的情况下调用这些函数将打印弃用警告,以与 digestundefined 时的行为保持一致。

¥Beginning in Node.js v11.0.0, calling these functions with digest set to null would print a deprecation warning to align with the behavior when digest is undefined.

然而现在,传递 undefinednull 将抛出 TypeError

¥Now, however, passing either undefined or null will throw a TypeError.

DEP0010:crypto.createCredentials#

类型:生命结束

¥Type: End-of-Life

crypto.createCredentials() API 已删除。请改用 tls.createSecureContext()

¥The crypto.createCredentials() API was removed. Please use tls.createSecureContext() instead.

DEP0011:crypto.Credentials#

类型:生命结束

¥Type: End-of-Life

crypto.Credentials 类已删除。请改用 tls.SecureContext

¥The crypto.Credentials class was removed. Please use tls.SecureContext instead.

DEP0012:Domain.dispose#

类型:生命结束

¥Type: End-of-Life

Domain.dispose() 已被删除。而是通过在域上设置的错误事件处理程序显式地从失败的 I/O 操作中恢复。

¥Domain.dispose() has been removed. Recover from failed I/O actions explicitly via error event handlers set on the domain instead.

DEP0013:fs 不带回调的异步函数#

¥DEP0013: fs asynchronous function without callback

类型:生命结束

¥Type: End-of-Life

在 Node.js 10.0.0 及更高版本中调用不带回调的异步函数会抛出 TypeError。参见 https://github.com/nodejs/node/pull/12562

¥Calling an asynchronous function without a callback throws a TypeError in Node.js 10.0.0 onwards. See https://github.com/nodejs/node/pull/12562.

DEP0014:fs.read 旧版字符串接口#

¥DEP0014: fs.read legacy String interface

类型:生命结束

¥Type: End-of-Life

fs.read() 旧版 String 接口已弃用。请改用文档中提到的 Buffer API。

¥The fs.read() legacy String interface is deprecated. Use the Buffer API as mentioned in the documentation instead.

DEP0015:fs.readSync 旧版字符串接口#

¥DEP0015: fs.readSync legacy String interface

类型:生命结束

¥Type: End-of-Life

fs.readSync() 旧版 String 接口已弃用。请改用文档中提到的 Buffer API。

¥The fs.readSync() legacy String interface is deprecated. Use the Buffer API as mentioned in the documentation instead.

DEP0016:GLOBAL/root#

类型:生命结束

¥Type: End-of-Life

global 属性的 GLOBALroot 别名在 Node.js 6.0.0 中已弃用,此后已被删除。

¥The GLOBAL and root aliases for the global property were deprecated in Node.js 6.0.0 and have since been removed.

DEP0017:Intl.v8BreakIterator#

类型:生命结束

¥Type: End-of-Life

Intl.v8BreakIterator 是非标准的扩展,已被删除。参见 Intl.Segmenter

¥Intl.v8BreakIterator was a non-standard extension and has been removed. See Intl.Segmenter.

DEP0018:未处理的 promise 拒绝#

¥DEP0018: Unhandled promise rejections

类型:生命结束

¥Type: End-of-Life

未处理的 promise 拒绝已弃用。默认情况下,未处理的 promise 拒绝会以非零退出代码终止 Node.js 进程。要更改 Node.js 处理未处理拒绝的方式,请使用 --unhandled-rejections 命令行选项。

¥Unhandled promise rejections are deprecated. By default, promise rejections that are not handled terminate the Node.js process with a non-zero exit code. To change the way Node.js treats unhandled rejections, use the --unhandled-rejections command-line option.

DEP0019:require('.') 解析外部目录#

¥DEP0019: require('.') resolved outside directory

类型:生命结束

¥Type: End-of-Life

在某些情况下,require('.') 可以在包目录之外解析。此行为已被删除。

¥In certain cases, require('.') could resolve outside the package directory. This behavior has been removed.

DEP0020:Server.connections#

类型:生命结束

¥Type: End-of-Life

Server.connections 属性在 Node.js v0.9.7 中已弃用并已被删除。请改用 Server.getConnections() 方法。

¥The Server.connections property was deprecated in Node.js v0.9.7 and has been removed. Please use the Server.getConnections() method instead.

DEP0021:Server.listenFD#

类型:生命结束

¥Type: End-of-Life

Server.listenFD() 方法已弃用并删除。请改用 Server.listen({fd: <number>})

¥The Server.listenFD() method was deprecated and removed. Please use Server.listen({fd: <number>}) instead.

DEP0022:os.tmpDir()#

类型:生命结束

¥Type: End-of-Life

os.tmpDir() API 在 Node.js 7.0.0 中被弃用,并已被删除。请改用 os.tmpdir()

¥The os.tmpDir() API was deprecated in Node.js 7.0.0 and has since been removed. Please use os.tmpdir() instead.

DEP0023:os.getNetworkInterfaces()#

类型:生命结束

¥Type: End-of-Life

os.getNetworkInterfaces() 方法已弃用。请改用 os.networkInterfaces() 方法。

¥The os.getNetworkInterfaces() method is deprecated. Please use the os.networkInterfaces() method instead.

DEP0024:REPLServer.prototype.convertToContext()#

类型:生命结束

¥Type: End-of-Life

REPLServer.prototype.convertToContext() API 已被删除。

¥The REPLServer.prototype.convertToContext() API has been removed.

DEP0025:require('node:sys')#

类型:运行时

¥Type: Runtime

node:sys 模块已弃用。请改用 util 模块。

¥The node:sys module is deprecated. Please use the util module instead.

DEP0026:util.print()#

类型:生命结束

¥Type: End-of-Life

util.print() 已被删除。请改用 console.log()

¥util.print() has been removed. Please use console.log() instead.

DEP0027:util.puts()#

类型:生命结束

¥Type: End-of-Life

util.puts() 已被删除。请改用 console.log()

¥util.puts() has been removed. Please use console.log() instead.

DEP0028:util.debug()#

类型:生命结束

¥Type: End-of-Life

util.debug() 已被删除。请改用 console.error()

¥util.debug() has been removed. Please use console.error() instead.

DEP0029:util.error()#

类型:生命结束

¥Type: End-of-Life

util.error() 已被删除。请改用 console.error()

¥util.error() has been removed. Please use console.error() instead.

DEP0030:SlowBuffer#

类型:仅文档

¥Type: Documentation-only

SlowBuffer 类已弃用。请改用 Buffer.allocUnsafeSlow(size)

¥The SlowBuffer class is deprecated. Please use Buffer.allocUnsafeSlow(size) instead.

DEP0031:ecdh.setPublicKey()#

类型:仅文档

¥Type: Documentation-only

ecdh.setPublicKey() 方法现已弃用,因为它包含在 API 中没有用处。

¥The ecdh.setPublicKey() method is now deprecated as its inclusion in the API is not useful.

DEP0032:node:domain 模块#

¥DEP0032: node:domain module

类型:仅文档

¥Type: Documentation-only

domain 模块已弃用,不应使用。

¥The domain module is deprecated and should not be used.

DEP0033:EventEmitter.listenerCount()#

类型:仅文档

¥Type: Documentation-only

events.listenerCount(emitter, eventName) API 已弃用。请改用 emitter.listenerCount(eventName)

¥The events.listenerCount(emitter, eventName) API is deprecated. Please use emitter.listenerCount(eventName) instead.

DEP0034:fs.exists(path, callback)#

类型:仅文档

¥Type: Documentation-only

fs.exists(path, callback) API 已弃用。请改用 fs.stat()fs.access()

¥The fs.exists(path, callback) API is deprecated. Please use fs.stat() or fs.access() instead.

DEP0035:fs.lchmod(path, mode, callback)#

类型:仅文档

¥Type: Documentation-only

fs.lchmod(path, mode, callback) API 已弃用。

¥The fs.lchmod(path, mode, callback) API is deprecated.

DEP0036:fs.lchmodSync(path, mode)#

类型:仅文档

¥Type: Documentation-only

fs.lchmodSync(path, mode) API 已弃用。

¥The fs.lchmodSync(path, mode) API is deprecated.

DEP0037:fs.lchown(path, uid, gid, callback)#

类型:撤销弃用

¥Type: Deprecation revoked

fs.lchown(path, uid, gid, callback) API 已弃用。由于在 libuv 中添加了必需的支持 API,因此弃用已被撤销。

¥The fs.lchown(path, uid, gid, callback) API was deprecated. The deprecation was revoked because the requisite supporting APIs were added in libuv.

DEP0038:fs.lchownSync(path, uid, gid)#

类型:撤销弃用

¥Type: Deprecation revoked

fs.lchownSync(path, uid, gid) API 已弃用。由于在 libuv 中添加了必需的支持 API,因此弃用已被撤销。

¥The fs.lchownSync(path, uid, gid) API was deprecated. The deprecation was revoked because the requisite supporting APIs were added in libuv.

DEP0039:require.extensions#

类型:仅文档

¥Type: Documentation-only

require.extensions 属性已弃用。

¥The require.extensions property is deprecated.

DEP0040:node:punycode 模块#

¥DEP0040: node:punycode module

类型:仅文档(支持 --pending-deprecation

¥Type: Documentation-only (supports --pending-deprecation)

punycode 模块已弃用。请改用用户空间替代方案。

¥The punycode module is deprecated. Please use a userland alternative instead.

DEP0041:NODE_REPL_HISTORY_FILE 环境变量#

¥DEP0041: NODE_REPL_HISTORY_FILE environment variable

类型:生命结束

¥Type: End-of-Life

NODE_REPL_HISTORY_FILE 环境变量已删除。请改用 NODE_REPL_HISTORY

¥The NODE_REPL_HISTORY_FILE environment variable was removed. Please use NODE_REPL_HISTORY instead.

DEP0042:tls.CryptoStream#

类型:生命结束

¥Type: End-of-Life

tls.CryptoStream 类已删除。请改用 tls.TLSSocket

¥The tls.CryptoStream class was removed. Please use tls.TLSSocket instead.

DEP0043:tls.SecurePair#

类型:仅文档

¥Type: Documentation-only

tls.SecurePair 类已弃用。请改用 tls.TLSSocket

¥The tls.SecurePair class is deprecated. Please use tls.TLSSocket instead.

DEP0044:util.isArray()#

类型:仅文档

¥Type: Documentation-only

util.isArray() API 已弃用。请改用 Array.isArray()

¥The util.isArray() API is deprecated. Please use Array.isArray() instead.

DEP0045:util.isBoolean()#

类型:仅文档

¥Type: Documentation-only

util.isBoolean() API 已弃用。

¥The util.isBoolean() API is deprecated.

DEP0046:util.isBuffer()#

类型:仅文档

¥Type: Documentation-only

util.isBuffer() API 已弃用。请改用 Buffer.isBuffer()

¥The util.isBuffer() API is deprecated. Please use Buffer.isBuffer() instead.

DEP0047:util.isDate()#

类型:仅文档

¥Type: Documentation-only

util.isDate() API 已弃用。

¥The util.isDate() API is deprecated.

DEP0048:util.isError()#

类型:仅文档

¥Type: Documentation-only

util.isError() API 已弃用。

¥The util.isError() API is deprecated.

DEP0049:util.isFunction()#

类型:仅文档

¥Type: Documentation-only

util.isFunction() API 已弃用。

¥The util.isFunction() API is deprecated.

DEP0050:util.isNull()#

类型:仅文档

¥Type: Documentation-only

util.isNull() API 已弃用。

¥The util.isNull() API is deprecated.

DEP0051:util.isNullOrUndefined()#

类型:仅文档

¥Type: Documentation-only

util.isNullOrUndefined() API 已弃用。

¥The util.isNullOrUndefined() API is deprecated.

DEP0052:util.isNumber()#

类型:仅文档

¥Type: Documentation-only

util.isNumber() API 已弃用。

¥The util.isNumber() API is deprecated.

DEP0053:util.isObject()#

类型:仅文档

¥Type: Documentation-only

util.isObject() API 已弃用。

¥The util.isObject() API is deprecated.

DEP0054:util.isPrimitive()#

类型:仅文档

¥Type: Documentation-only

util.isPrimitive() API 已弃用。

¥The util.isPrimitive() API is deprecated.

DEP0055:util.isRegExp()#

类型:仅文档

¥Type: Documentation-only

util.isRegExp() API 已弃用。

¥The util.isRegExp() API is deprecated.

DEP0056:util.isString()#

类型:仅文档

¥Type: Documentation-only

util.isString() API 已弃用。

¥The util.isString() API is deprecated.

DEP0057:util.isSymbol()#

类型:仅文档

¥Type: Documentation-only

util.isSymbol() API 已弃用。

¥The util.isSymbol() API is deprecated.

DEP0058:util.isUndefined()#

类型:仅文档

¥Type: Documentation-only

util.isUndefined() API 已弃用。

¥The util.isUndefined() API is deprecated.

DEP0059:util.log()#

类型:仅文档

¥Type: Documentation-only

util.log() API 已弃用。

¥The util.log() API is deprecated.

DEP0060:util._extend()#

类型:仅文档

¥Type: Documentation-only

util._extend() API 已弃用。

¥The util._extend() API is deprecated.

DEP0061:fs.SyncWriteStream#

类型:生命结束

¥Type: End-of-Life

fs.SyncWriteStream 类从未打算成为可公开访问的 API,因此已被删除。没有可用的替代 API。请使用用户空间替代方案。

¥The fs.SyncWriteStream class was never intended to be a publicly accessible API and has been removed. No alternative API is available. Please use a userland alternative.

DEP0062:node --debug#

类型:生命结束

¥Type: End-of-Life

--debug 激活旧版的 V8 调试器接口,该接口从 V8 5.8 开始被删除。它被 Inspector 取代,后者由 --inspect 激活。

¥--debug activates the legacy V8 debugger interface, which was removed as of V8 5.8. It is replaced by Inspector which is activated with --inspect instead.

DEP0063:ServerResponse.prototype.writeHeader()#

类型:仅文档

¥Type: Documentation-only

node:http 模块 ServerResponse.prototype.writeHeader() API 已弃用。请改用 ServerResponse.prototype.writeHead()

¥The node:http module ServerResponse.prototype.writeHeader() API is deprecated. Please use ServerResponse.prototype.writeHead() instead.

ServerResponse.prototype.writeHeader() 方法从未被记录为官方支持的 API。

¥The ServerResponse.prototype.writeHeader() method was never documented as an officially supported API.

DEP0064:tls.createSecurePair()#

类型:运行时

¥Type: Runtime

tls.createSecurePair() API 在 Node.js 0.11.3 的文档中被弃用。用户应该改用 tls.Socket

¥The tls.createSecurePair() API was deprecated in documentation in Node.js 0.11.3. Users should use tls.Socket instead.

DEP0065:repl.REPL_MODE_MAGICNODE_REPL_MODE=magic#

¥DEP0065: repl.REPL_MODE_MAGIC and NODE_REPL_MODE=magic

类型:生命结束

¥Type: End-of-Life

用于 replMode 选项的 node:repl 模块的 REPL_MODE_MAGIC 常量已被删除。从 Node.js 6.0.0 开始,当导入 V8 5.0 时,它的行为在功能上与 REPL_MODE_SLOPPY 相同。请改用 REPL_MODE_SLOPPY

¥The node:repl module's REPL_MODE_MAGIC constant, used for replMode option, has been removed. Its behavior has been functionally identical to that of REPL_MODE_SLOPPY since Node.js 6.0.0, when V8 5.0 was imported. Please use REPL_MODE_SLOPPY instead.

NODE_REPL_MODE 环境变量用于设置交互式 node 会话的底层 replMode。它的值 magic 也被删除。请改用 sloppy

¥The NODE_REPL_MODE environment variable is used to set the underlying replMode of an interactive node session. Its value, magic, is also removed. Please use sloppy instead.

DEP0066:OutgoingMessage.prototype._headers, OutgoingMessage.prototype._headerNames#

类型:运行时

¥Type: Runtime

node:http 模块 OutgoingMessage.prototype._headersOutgoingMessage.prototype._headerNames 属性已弃用。使用一种公共方法(例如 OutgoingMessage.prototype.getHeader()OutgoingMessage.prototype.getHeaders()OutgoingMessage.prototype.getHeaderNames()OutgoingMessage.prototype.getRawHeaderNames()OutgoingMessage.prototype.hasHeader()OutgoingMessage.prototype.removeHeader()OutgoingMessage.prototype.setHeader())处理传出标头。

¥The node:http module OutgoingMessage.prototype._headers and OutgoingMessage.prototype._headerNames properties are deprecated. Use one of the public methods (e.g. OutgoingMessage.prototype.getHeader(), OutgoingMessage.prototype.getHeaders(), OutgoingMessage.prototype.getHeaderNames(), OutgoingMessage.prototype.getRawHeaderNames(), OutgoingMessage.prototype.hasHeader(), OutgoingMessage.prototype.removeHeader(), OutgoingMessage.prototype.setHeader()) for working with outgoing headers.

OutgoingMessage.prototype._headersOutgoingMessage.prototype._headerNames 属性从未被记录为官方支持的属性。

¥The OutgoingMessage.prototype._headers and OutgoingMessage.prototype._headerNames properties were never documented as officially supported properties.

DEP0067:OutgoingMessage.prototype._renderHeaders#

类型:仅文档

¥Type: Documentation-only

node:http 模块 OutgoingMessage.prototype._renderHeaders() API 已弃用。

¥The node:http module OutgoingMessage.prototype._renderHeaders() API is deprecated.

OutgoingMessage.prototype._renderHeaders 属性从未被记录为官方支持的 API。

¥The OutgoingMessage.prototype._renderHeaders property was never documented as an officially supported API.

DEP0068:node debug#

类型:生命结束

¥Type: End-of-Life

node debug 对应于旧版的命令行调试器,它已被替换为可通过 node inspect 获得的基于 V8 检查器的命令行调试器。

¥node debug corresponds to the legacy CLI debugger which has been replaced with a V8-inspector based CLI debugger available through node inspect.

DEP0069:vm.runInDebugContext(string)#

类型:生命结束

¥Type: End-of-Life

DebugContext 已在 V8 中删除,在 Node.js 10+ 中不可用。

¥DebugContext has been removed in V8 and is not available in Node.js 10+.

DebugContext 是一个实验性 API。

¥DebugContext was an experimental API.

DEP0070:async_hooks.currentId()#

类型:生命结束

¥Type: End-of-Life

为清楚起见,async_hooks.currentId() 已重命名为 async_hooks.executionAsyncId()

¥async_hooks.currentId() was renamed to async_hooks.executionAsyncId() for clarity.

此更改是在 async_hooks 是实验性 API 时进行的。

¥This change was made while async_hooks was an experimental API.

DEP0071:async_hooks.triggerId()#

类型:生命结束

¥Type: End-of-Life

为清楚起见,async_hooks.triggerId() 已重命名为 async_hooks.triggerAsyncId()

¥async_hooks.triggerId() was renamed to async_hooks.triggerAsyncId() for clarity.

此更改是在 async_hooks 是实验性 API 时进行的。

¥This change was made while async_hooks was an experimental API.

DEP0072:async_hooks.AsyncResource.triggerId()#

类型:生命结束

¥Type: End-of-Life

为清楚起见,async_hooks.AsyncResource.triggerId() 已重命名为 async_hooks.AsyncResource.triggerAsyncId()

¥async_hooks.AsyncResource.triggerId() was renamed to async_hooks.AsyncResource.triggerAsyncId() for clarity.

此更改是在 async_hooks 是实验性 API 时进行的。

¥This change was made while async_hooks was an experimental API.

DEP0073:net.Server 的几个内部属性#

¥DEP0073: Several internal properties of net.Server

类型:生命结束

¥Type: End-of-Life

使用不适当的名称访问 net.Server 实例的多个内部未记录属性已被弃用。

¥Accessing several internal, undocumented properties of net.Server instances with inappropriate names is deprecated.

由于原始 API 未记录且通常对非内部代码没有用,因此未提供替代 API。

¥As the original API was undocumented and not generally useful for non-internal code, no replacement API is provided.

DEP0074:REPLServer.bufferedCommand#

类型:生命结束

¥Type: End-of-Life

REPLServer.bufferedCommand 属性已弃用,取而代之的是 REPLServer.clearBufferedCommand()

¥The REPLServer.bufferedCommand property was deprecated in favor of REPLServer.clearBufferedCommand().

DEP0075:REPLServer.parseREPLKeyword()#

类型:生命结束

¥Type: End-of-Life

REPLServer.parseREPLKeyword() 已从用户空间可见性中删除。

¥REPLServer.parseREPLKeyword() was removed from userland visibility.

DEP0076:tls.parseCertString()#

类型:生命结束

¥Type: End-of-Life

tls.parseCertString() 是一个简单的解析助手,被错误地公开了。虽然它应该解析证书主题和颁发者字符串,但它从未正确处理多值相对可分辨名称。

¥tls.parseCertString() was a trivial parsing helper that was made public by mistake. While it was supposed to parse certificate subject and issuer strings, it never handled multi-value Relative Distinguished Names correctly.

本文档的早期版本建议使用 querystring.parse() 作为 tls.parseCertString() 的替代方法。但是,querystring.parse() 也没有正确处理所有证书主题,因此不应使用。

¥Earlier versions of this document suggested using querystring.parse() as an alternative to tls.parseCertString(). However, querystring.parse() also does not handle all certificate subjects correctly and should not be used.

DEP0077:Module._debug()#

类型:运行时

¥Type: Runtime

Module._debug() 已弃用。

¥Module._debug() is deprecated.

Module._debug() 函数从未被记录为官方支持的 API。

¥The Module._debug() function was never documented as an officially supported API.

DEP0078:REPLServer.turnOffEditorMode()#

类型:生命结束

¥Type: End-of-Life

REPLServer.turnOffEditorMode() 已从用户空间可见性中删除。

¥REPLServer.turnOffEditorMode() was removed from userland visibility.

DEP0079:通过 .inspect() 对对象进行自定义检查函数#

¥DEP0079: Custom inspection function on objects via .inspect()

类型:生命结束

¥Type: End-of-Life

不推荐使用对象上名为 inspect 的属性来指定 util.inspect() 的自定义检查函数。改用 util.inspect.custom。为了与版本 6.4.0 之前的 Node.js 向后兼容,可以指定两者。

¥Using a property named inspect on an object to specify a custom inspection function for util.inspect() is deprecated. Use util.inspect.custom instead. For backward compatibility with Node.js prior to version 6.4.0, both can be specified.

DEP0080:path._makeLong()#

类型:仅文档

¥Type: Documentation-only

内部 path._makeLong() 不供公众使用。但是,userland 模块发现它很有用。内部 API 已弃用并替换为相同的公共 path.toNamespacedPath() 方法。

¥The internal path._makeLong() was not intended for public use. However, userland modules have found it useful. The internal API is deprecated and replaced with an identical, public path.toNamespacedPath() method.

DEP0081:fs.truncate() 使用文件描述符#

¥DEP0081: fs.truncate() using a file descriptor

类型:运行时

¥Type: Runtime

不推荐使用 fs.truncate() fs.truncateSync() 与文件描述符一起使用。请使用 fs.ftruncate()fs.ftruncateSync() 来处理文件描述符。

¥fs.truncate() fs.truncateSync() usage with a file descriptor is deprecated. Please use fs.ftruncate() or fs.ftruncateSync() to work with file descriptors.

DEP0082:REPLServer.prototype.memory()#

类型:生命结束

¥Type: End-of-Life

REPLServer.prototype.memory() 只对 REPLServer 本身的内部机制是必需的。不要使用此功能。

¥REPLServer.prototype.memory() is only necessary for the internal mechanics of the REPLServer itself. Do not use this function.

DEP0083:通过将 ecdhCurve 设置为 false 禁用 ECDH#

¥DEP0083: Disabling ECDH by setting ecdhCurve to false

类型:生命尽头。

¥Type: End-of-Life.

tls.createSecureContext()tls.TLSSocketecdhCurve 选项可以设置为 false 以仅在服务器上完全禁用 ECDH。为了准备迁移到 OpenSSL 1.1.0 并与客户端保持一致,此模式已被弃用,现在不受支持。请改用 ciphers 参数。

¥The ecdhCurve option to tls.createSecureContext() and tls.TLSSocket could be set to false to disable ECDH entirely on the server only. This mode was deprecated in preparation for migrating to OpenSSL 1.1.0 and consistency with the client and is now unsupported. Use the ciphers parameter instead.

DEP0084:需要打包的内部依赖#

¥DEP0084: requiring bundled internal dependencies

类型:生命结束

¥Type: End-of-Life

自 Node.js 4.4.0 和 5.2.0 版本以来,几个仅供内部使用的模块通过 require() 错误地暴露给用户代码。这些模块是:

¥Since Node.js versions 4.4.0 and 5.2.0, several modules only intended for internal usage were mistakenly exposed to user code through require(). These modules were:

  • v8/tools/codemap

  • v8/tools/consarray

  • v8/tools/csvparser

  • v8/tools/logreader

  • v8/tools/profile_view

  • v8/tools/profile

  • v8/tools/SourceMap

  • v8/tools/splaytree

  • v8/tools/tickprocessor-driver

  • v8/tools/tickprocessor

  • node-inspect/lib/_inspect(从 7.6.0 开始)

    ¥node-inspect/lib/_inspect (from 7.6.0)

  • node-inspect/lib/internal/inspect_client(从 7.6.0 开始)

    ¥node-inspect/lib/internal/inspect_client (from 7.6.0)

  • node-inspect/lib/internal/inspect_repl(从 7.6.0 开始)

    ¥node-inspect/lib/internal/inspect_repl (from 7.6.0)

v8/* 模块没有任何导出,如果不按特定顺序导入,实际上会引发错误。因此,几乎没有通过 require() 导入它们的合法用例。

¥The v8/* modules do not have any exports, and if not imported in a specific order would in fact throw errors. As such there are virtually no legitimate use cases for importing them through require().

另一方面,node-inspect 可以通过包管理器在本地安装,因为它以相同的名称发布在 npm 注册表上。如果完成,则无需修改源代码。

¥On the other hand, node-inspect can be installed locally through a package manager, as it is published on the npm registry under the same name. No source code modification is necessary if that is done.

DEP0085:AsyncHooks 敏感 API#

¥DEP0085: AsyncHooks sensitive API

类型:生命结束

¥Type: End-of-Life

AsyncHooks 敏感 API 从未记录在案,并且存在各种小问题。改用 AsyncResource API。参见 https://github.com/nodejs/node/issues/15572

¥The AsyncHooks sensitive API was never documented and had various minor issues. Use the AsyncResource API instead. See https://github.com/nodejs/node/issues/15572.

DEP0086:删除 runInAsyncIdScope#

¥DEP0086: Remove runInAsyncIdScope

类型:生命结束

¥Type: End-of-Life

runInAsyncIdScope 不会触发 'before''after' 事件,因此会导致很多问题。参见 https://github.com/nodejs/node/issues/14328

¥runInAsyncIdScope doesn't emit the 'before' or 'after' event and can thus cause a lot of issues. See https://github.com/nodejs/node/issues/14328.

DEP0089:require('node:assert')#

类型:撤销弃用

¥Type: Deprecation revoked

不建议直接导入断言,因为公开的函数使用松散的相等性检查。由于不鼓励使用 node:assert 模块,因此弃用被撤销,并且弃用导致开发者感到困惑。

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

DEP0090:GCM 身份验证标签长度无效#

¥DEP0090: Invalid GCM authentication tag lengths

类型:生命结束

¥Type: End-of-Life

Node.js 用于支持调用 decipher.setAuthTag() 时 OpenSSL 接受的所有 GCM 身份验证标记长度。从 Node.js v11.0.0 开始,只允许 128、120、112、104、96、64 和 32 位的身份验证标记长度。根据 NIST SP 800-38D,其他长度的身份验证标签无效。

¥Node.js used to support all GCM authentication tag lengths which are accepted by OpenSSL when calling decipher.setAuthTag(). Beginning with Node.js v11.0.0, only authentication tag lengths of 128, 120, 112, 104, 96, 64, and 32 bits are allowed. Authentication tags of other lengths are invalid per NIST SP 800-38D.

DEP0091:crypto.DEFAULT_ENCODING#

类型:生命结束

¥Type: End-of-Life

crypto.DEFAULT_ENCODING 属性的存在只是为了与版本 0.9.3 之前的 Node.js 版本兼容,并且已被删除。

¥The crypto.DEFAULT_ENCODING property only existed for compatibility with Node.js releases prior to versions 0.9.3 and has been removed.

DEP0092:顶层 this 绑定到 module.exports#

¥DEP0092: Top-level this bound to module.exports

类型:仅文档

¥Type: Documentation-only

将属性分配给顶层 this 作为 module.exports 的替代方案已被弃用。开发者应改用 exportsmodule.exports

¥Assigning properties to the top-level this as an alternative to module.exports is deprecated. Developers should use exports or module.exports instead.

DEP0093:crypto.fips 已弃用并被替换#

¥DEP0093: crypto.fips is deprecated and replaced

类型:仅文档

¥Type: Documentation-only

crypto.fips 属性已弃用。请改用 crypto.setFips()crypto.getFips()

¥The crypto.fips property is deprecated. Please use crypto.setFips() and crypto.getFips() instead.

DEP0094:将 assert.fail() 与多个参数一起使用#

¥DEP0094: Using assert.fail() with more than one argument

类型:运行时

¥Type: Runtime

不推荐将 assert.fail() 与多个参数一起使用。使用只有一个参数的 assert.fail() 或使用不同的 node:assert 模块方法。

¥Using assert.fail() with more than one argument is deprecated. Use assert.fail() with only one argument or use a different node:assert module method.

DEP0095:timers.enroll()#

类型:运行时

¥Type: Runtime

timers.enroll() 已弃用。请改用公开记录的 setTimeout()setInterval()

¥timers.enroll() is deprecated. Please use the publicly documented setTimeout() or setInterval() instead.

DEP0096:timers.unenroll()#

类型:运行时

¥Type: Runtime

timers.unenroll() 已弃用。请改用公开记录的 clearTimeout()clearInterval()

¥timers.unenroll() is deprecated. Please use the publicly documented clearTimeout() or clearInterval() instead.

DEP0097:MakeCallback 具有 domain 属性#

¥DEP0097: MakeCallback with domain property

类型:运行时

¥Type: Runtime

添加 domain 属性以承载上下文的 MakeCallback 用户应开始使用 MakeCallbackCallbackScopeasync_context 变体,或高级 AsyncResource 类。

¥Users of MakeCallback that add the domain property to carry context, should start using the async_context variant of MakeCallback or CallbackScope, or the high-level AsyncResource class.

DEP0098:AsyncHooks 嵌入器 AsyncResource.emitBeforeAsyncResource.emitAfter API#

¥DEP0098: AsyncHooks embedder AsyncResource.emitBefore and AsyncResource.emitAfter APIs

类型:生命结束

¥Type: End-of-Life

AsyncHooks 提供的嵌入式 API 公开了 .emitBefore().emitAfter() 方法,这些方法很容易被错误使用,从而导致不可恢复的错误。

¥The embedded API provided by AsyncHooks exposes .emitBefore() and .emitAfter() methods which are very easy to use incorrectly which can lead to unrecoverable errors.

请改用 asyncResource.runInAsyncScope() API,它提供了更安全、更方便的替代方案。参见 https://github.com/nodejs/node/pull/18513

¥Use asyncResource.runInAsyncScope() API instead which provides a much safer, and more convenient, alternative. See https://github.com/nodejs/node/pull/18513.

DEP0099:异步上下文不感知 node::MakeCallback C++ API#

¥DEP0099: Async context-unaware node::MakeCallback C++ APIs

类型:编译时

¥Type: Compile-time

可用于原生插件的某些版本的 node::MakeCallback API 已弃用。请使用接受 async_context 参数的 API 版本。

¥Certain versions of node::MakeCallback APIs available to native addons are deprecated. Please use the versions of the API that accept an async_context parameter.

DEP0100:process.assert()#

类型:运行时

¥Type: Runtime

process.assert() 已弃用。请改用 assert 模块。

¥process.assert() is deprecated. Please use the assert module instead.

这从来都不是记录在案的功能。

¥This was never a documented feature.

DEP0101:--with-lttng#

类型:生命结束

¥Type: End-of-Life

--with-lttng 编译时选项已被删除。

¥The --with-lttng compile-time option has been removed.

DEP0102:在 Buffer#(read|write) 操作中使用 noAssert#

¥DEP0102: Using noAssert in Buffer#(read|write) operations

类型:生命结束

¥Type: End-of-Life

使用 noAssert 参数不再起作用。无论 noAssert 的值如何,都会验证所有输入。跳过验证可能会导致难以发现的错误和崩溃。

¥Using the noAssert argument has no functionality anymore. All input is verified regardless of the value of noAssert. Skipping the verification could lead to hard-to-find errors and crashes.

DEP0103:process.binding('util').is[...] 类型检查#

¥DEP0103: process.binding('util').is[...] typechecks

类型:仅文档(支持 --pending-deprecation

¥Type: Documentation-only (supports --pending-deprecation)

通常应避免使用 process.binding()。特别是类型检查方法可以用 util.types 代替。

¥Using process.binding() in general should be avoided. The type checking methods in particular can be replaced by using util.types.

此弃用已被 process.binding() API (DEP0111) 的弃用所取代。

¥This deprecation has been superseded by the deprecation of the process.binding() API (DEP0111).

DEP0104:process.env 字符串强制#

¥DEP0104: process.env string coercion

类型:仅文档(支持 --pending-deprecation

¥Type: Documentation-only (supports --pending-deprecation)

将非字符串属性分配给 process.env 时,分配的值将隐式转换为字符串。如果分配的值不是字符串、布尔值或数字,则不推荐使用此行为。将来,这样的分配可能会导致抛出错误。请先将该属性转换为字符串,然后再将其分配给 process.env

¥When assigning a non-string property to process.env, the assigned value is implicitly converted to a string. This behavior is deprecated if the assigned value is not a string, boolean, or number. In the future, such assignment might result in a thrown error. Please convert the property to a string before assigning it to process.env.

DEP0105:decipher.finaltol#

类型:生命结束

¥Type: End-of-Life

decipher.finaltol() 从未被记录,它是 decipher.final() 的别名。此 API 已被移除,建议改用 decipher.final()

¥decipher.finaltol() has never been documented and was an alias for decipher.final(). This API has been removed, and it is recommended to use decipher.final() instead.

DEP0106:crypto.createCiphercrypto.createDecipher#

¥DEP0106: crypto.createCipher and crypto.createDecipher

类型:运行时

¥Type: Runtime

必须避免使用 crypto.createCipher()crypto.createDecipher(),因为它们使用弱密钥派生函数(无盐的 MD5)和静态初始化向量。建议使用 crypto.pbkdf2()crypto.scrypt() 和随机盐派生密钥,并使用 crypto.createCipheriv()crypto.createDecipheriv() 分别获得 CipherDecipher 对象。

¥Using crypto.createCipher() and crypto.createDecipher() must be avoided as they use a weak key derivation function (MD5 with no salt) and static initialization vectors. It is recommended to derive a key using crypto.pbkdf2() or crypto.scrypt() with random salts and to use crypto.createCipheriv() and crypto.createDecipheriv() to obtain the Cipher and Decipher objects respectively.

DEP0107:tls.convertNPNProtocols()#

类型:生命结束

¥Type: End-of-Life

这是一个未记录的辅助函数,不打算在 Node.js 核心之外使用,并因删除 NPN(下一个协议协商)支持而被废弃。

¥This was an undocumented helper function not intended for use outside Node.js core and obsoleted by the removal of NPN (Next Protocol Negotiation) support.

DEP0108:zlib.bytesRead#

类型:运行时

¥Type: Runtime

弃用的 zlib.bytesWritten 别名。选择这个原始名称是因为将值解释为引擎读取的字节数也是有意义的,但与 Node.js 中以这些名称公开值的其他流不一致。

¥Deprecated alias for zlib.bytesWritten. This original name was chosen because it also made sense to interpret the value as the number of bytes read by the engine, but is inconsistent with other streams in Node.js that expose values under these names.

DEP0109:httphttpstls 对无效 URL 的支持#

¥DEP0109: http, https, and tls support for invalid URLs

类型:生命结束

¥Type: End-of-Life

通过 http.request()http.get()https.request()https.get()tls.checkServerIdentity() API 接受了一些以前支持(但严格无效)的 URL,因为这些 URL 已被旧版 url.parse() API 接受。上述 API 现在使用要求严格有效 URL 的 WHATWG URL 解析器。传递无效的 URL 已被弃用,将来会删除支持。

¥Some previously supported (but strictly invalid) URLs were accepted through the http.request(), http.get(), https.request(), https.get(), and tls.checkServerIdentity() APIs because those were accepted by the legacy url.parse() API. The mentioned APIs now use the WHATWG URL parser that requires strictly valid URLs. Passing an invalid URL is deprecated and support will be removed in the future.

DEP0110:vm.Script 缓存数据#

¥DEP0110: vm.Script cached data

类型:仅文档

¥Type: Documentation-only

produceCachedData 选项已弃用。改用 script.createCachedData()

¥The produceCachedData option is deprecated. Use script.createCachedData() instead.

DEP0111:process.binding()#

类型:仅文档(支持 --pending-deprecation

¥Type: Documentation-only (supports --pending-deprecation)

process.binding() 仅供 Node.js 内部代码使用。

¥process.binding() is for use by Node.js internal code only.

虽然 process.binding() 一般尚未达到生命周期结束状态,但当 政策权限模型 启用时,它不可用。

¥While process.binding() has not reached End-of-Life status in general, it is unavailable when policies or the permission model are enabled.

DEP0112:dgram 私有 API#

¥DEP0112: dgram private APIs

类型:运行时

¥Type: Runtime

node:dgram 模块以前包含几个 API,这些 API 永远不会在 Node.js 核心之外访问:Socket.prototype._handleSocket.prototype._receivingSocket.prototype._bindStateSocket.prototype._queueSocket.prototype._reuseAddrSocket.prototype._healthCheck()Socket.prototype._stopReceiving()dgram._createSocketHandle()

¥The node:dgram module previously contained several APIs that were never meant to accessed outside of Node.js core: Socket.prototype._handle, Socket.prototype._receiving, Socket.prototype._bindState, Socket.prototype._queue, Socket.prototype._reuseAddr, Socket.prototype._healthCheck(), Socket.prototype._stopReceiving(), and dgram._createSocketHandle().

DEP0113:Cipher.setAuthTag(), Decipher.getAuthTag()#

类型:生命结束

¥Type: End-of-Life

Cipher.setAuthTag()Decipher.getAuthTag() 不再可用。他们从未被记录在案,并且会在被调用时抛出。

¥Cipher.setAuthTag() and Decipher.getAuthTag() are no longer available. They were never documented and would throw when called.

DEP0114:crypto._toBuf()#

类型:生命结束

¥Type: End-of-Life

crypto._toBuf() 函数并非设计为供 Node.js 核心之外的模块使用,因此已被删除。

¥The crypto._toBuf() function was not designed to be used by modules outside of Node.js core and was removed.

DEP0115:crypto.prng(), crypto.pseudoRandomBytes(), crypto.rng()#

类型:仅文档(支持 --pending-deprecation

¥Type: Documentation-only (supports --pending-deprecation)

在最近的 Node.js 版本中,crypto.randomBytes()crypto.pseudoRandomBytes() 之间没有区别。后者与未记录的别名 crypto.prng()crypto.rng() 一起被弃用,取而代之的是 crypto.randomBytes(),并且可能会在未来的版本中删除。

¥In recent versions of Node.js, there is no difference between crypto.randomBytes() and crypto.pseudoRandomBytes(). The latter is deprecated along with the undocumented aliases crypto.prng() and crypto.rng() in favor of crypto.randomBytes() and might be removed in a future release.

DEP0116:旧版 URL API#

¥DEP0116: Legacy URL API

类型:撤销弃用

¥Type: Deprecation revoked

旧版 URL API 已弃用。这包括 url.format()url.parse()url.resolve()旧版 urlObject。请改用 WHATWG URL API

¥The legacy URL API is deprecated. This includes url.format(), url.parse(), url.resolve(), and the legacy urlObject. Please use the WHATWG URL API instead.

DEP0117:原生加密句柄#

¥DEP0117: Native crypto handles

类型:生命结束

¥Type: End-of-Life

以前版本的 Node.js 通过 CipherDecipherDiffieHellmanDiffieHellmanGroupECDHHashHmacSignVerify 类的 _handle 属性向内部原生对象公开句柄。_handle 属性已被删除,因为不正确地使用原生对象会导致应用崩溃。

¥Previous versions of Node.js exposed handles to internal native objects through the _handle property of the Cipher, Decipher, DiffieHellman, DiffieHellmanGroup, ECDH, Hash, Hmac, Sign, and Verify classes. The _handle property has been removed because improper use of the native object can lead to crashing the application.

DEP0118:dns.lookup() 支持虚假主机名#

¥DEP0118: dns.lookup() support for a falsy host name

类型:运行时

¥Type: Runtime

由于向后兼容,以前版本的 Node.js 支持 dns.lookup() 和像 dns.lookup(false) 这样的虚假主机名。此行为未记录在案,并且被认为未在现实世界的应用中使用。它将成为 Node.js 未来版本中的一个错误。

¥Previous versions of Node.js supported dns.lookup() with a falsy host name like dns.lookup(false) due to backward compatibility. This behavior is undocumented and is thought to be unused in real world apps. It will become an error in future versions of Node.js.

DEP0119:process.binding('uv').errname() 私有 API#

¥DEP0119: process.binding('uv').errname() private API

类型:仅文档(支持 --pending-deprecation

¥Type: Documentation-only (supports --pending-deprecation)

process.binding('uv').errname() 已弃用。请改用 util.getSystemErrorName()

¥process.binding('uv').errname() is deprecated. Please use util.getSystemErrorName() instead.

DEP0120:Windows 性能计数器支持#

¥DEP0120: Windows Performance Counter support

类型:生命结束

¥Type: End-of-Life

Windows 性能计数器支持已从 Node.js 中删除。未记录的 COUNTER_NET_SERVER_CONNECTION()COUNTER_NET_SERVER_CONNECTION_CLOSE()COUNTER_HTTP_SERVER_REQUEST()COUNTER_HTTP_SERVER_RESPONSE()COUNTER_HTTP_CLIENT_REQUEST()COUNTER_HTTP_CLIENT_RESPONSE() 函数已被弃用。

¥Windows Performance Counter support has been removed from Node.js. The undocumented COUNTER_NET_SERVER_CONNECTION(), COUNTER_NET_SERVER_CONNECTION_CLOSE(), COUNTER_HTTP_SERVER_REQUEST(), COUNTER_HTTP_SERVER_RESPONSE(), COUNTER_HTTP_CLIENT_REQUEST(), and COUNTER_HTTP_CLIENT_RESPONSE() functions have been deprecated.

DEP0121:net._setSimultaneousAccepts()#

类型:运行时

¥Type: Runtime

未记录的 net._setSimultaneousAccepts() 函数最初用于在 Windows 上使用 node:child_processnode:cluster 模块时进行调试和性能调整。该功能通常用处不大,正在被删除。请参阅此处的讨论:https://github.com/nodejs/node/issues/18391

¥The undocumented net._setSimultaneousAccepts() function was originally intended for debugging and performance tuning when using the node:child_process and node:cluster modules on Windows. The function is not generally useful and is being removed. See discussion here: https://github.com/nodejs/node/issues/18391

DEP0122:tls Server.prototype.setOptions()#

类型:运行时

¥Type: Runtime

请改用 Server.prototype.setSecureContext()

¥Please use Server.prototype.setSecureContext() instead.

DEP0123:将 TLS ServerName 设置为 IP 地址#

¥DEP0123: setting the TLS ServerName to an IP address

类型:运行时

¥Type: Runtime

RFC 6066 不允许将 TLS ServerName 设置为 IP 地址。这将在未来的版本中被忽略。

¥Setting the TLS ServerName to an IP address is not permitted by RFC 6066. This will be ignored in a future version.

DEP0124:使用 REPLServer.rli#

¥DEP0124: using REPLServer.rli

类型:生命结束

¥Type: End-of-Life

此属性是对实例本身的引用。

¥This property is a reference to the instance itself.

DEP0125:require('node:_stream_wrap')#

类型:运行时

¥Type: Runtime

node:_stream_wrap 模块已弃用。

¥The node:_stream_wrap module is deprecated.

DEP0126:timers.active()#

类型:运行时

¥Type: Runtime

以前未记录的 timers.active() 已弃用。请改用公开记录的 timeout.refresh()。如果需要重新引用超时,自 Node.js 10 起可以使用 timeout.ref() 而不会影响性能。

¥The previously undocumented timers.active() is deprecated. Please use the publicly documented timeout.refresh() instead. If re-referencing the timeout is necessary, timeout.ref() can be used with no performance impact since Node.js 10.

DEP0127:timers._unrefActive()#

类型:运行时

¥Type: Runtime

以前未记录的和 "private" timers._unrefActive() 已弃用。请改用公开记录的 timeout.refresh()。如果需要取消引用超时,自 Node.js 10 起可以使用 timeout.unref() 而不会影响性能。

¥The previously undocumented and "private" timers._unrefActive() is deprecated. Please use the publicly documented timeout.refresh() instead. If unreferencing the timeout is necessary, timeout.unref() can be used with no performance impact since Node.js 10.

DEP0128:具有无效 main 入口和 index.js 文件的模块#

¥DEP0128: modules with an invalid main entry and an index.js file

类型:运行时

¥Type: Runtime

具有无效 main 条目(例如,./does-not-exist.js)并且在顶层目录中也具有 index.js 文件的模块将解析 index.js 文件。这已被弃用,并且会在未来的 Node.js 版本中引发错误。

¥Modules that have an invalid main entry (e.g., ./does-not-exist.js) and also have an index.js file in the top level directory will resolve the index.js file. That is deprecated and is going to throw an error in future Node.js versions.

DEP0129:ChildProcess._channel#

类型:运行时

¥Type: Runtime

spawn() 和类似函数返回的子进程对象的 _channel 属性不供公共使用。改用 ChildProcess.channel

¥The _channel property of child process objects returned by spawn() and similar functions is not intended for public use. Use ChildProcess.channel instead.

DEP0130:Module.createRequireFromPath()#

类型:生命结束

¥Type: End-of-Life

改用 module.createRequire()

¥Use module.createRequire() instead.

DEP0131:旧版 HTTP 解析器#

¥DEP0131: Legacy HTTP parser

类型:生命结束

¥Type: End-of-Life

在 12.0.0 之前的 Node.js 版本中默认使用的旧版 HTTP 解析器已弃用,并已在 v13.0.0 中删除。在 v13.0.0 之前,--http-parser=legacy 命令行标志可用于恢复使用旧版解析器。

¥The legacy HTTP parser, used by default in versions of Node.js prior to 12.0.0, is deprecated and has been removed in v13.0.0. Prior to v13.0.0, the --http-parser=legacy command-line flag could be used to revert to using the legacy parser.

DEP0132:worker.terminate() 具有回调#

¥DEP0132: worker.terminate() with callback

类型:运行时

¥Type: Runtime

将回调传递给 worker.terminate() 已弃用。请改用返回的 Promise,或监听工作进程的 'exit' 事件。

¥Passing a callback to worker.terminate() is deprecated. Use the returned Promise instead, or a listener to the worker's 'exit' event.

DEP0133:http connection#

类型:仅文档

¥Type: Documentation-only

response.connection 更喜欢 response.socket,比 request.connection 更喜欢 request.socket

¥Prefer response.socket over response.connection and request.socket over request.connection.

DEP0134:process._tickCallback#

类型:仅文档(支持 --pending-deprecation

¥Type: Documentation-only (supports --pending-deprecation)

process._tickCallback 属性从未被记录为官方支持的 API。

¥The process._tickCallback property was never documented as an officially supported API.

DEP0135:WriteStream.open()ReadStream.open() 是内部的#

¥DEP0135: WriteStream.open() and ReadStream.open() are internal

类型:运行时

¥Type: Runtime

WriteStream.open()ReadStream.open() 是未记录的内部 API,在用户空间中使用没有意义。文件流应始终通过其相应的工厂方法 fs.createWriteStream()fs.createReadStream()) 或通过在选项中传递文件描述符来打开。

¥WriteStream.open() and ReadStream.open() are undocumented internal APIs that do not make sense to use in userland. File streams should always be opened through their corresponding factory methods fs.createWriteStream() and fs.createReadStream()) or by passing a file descriptor in options.

DEP0136:http finished#

类型:仅文档

¥Type: Documentation-only

response.finished 表示 response.end() 是否已被调用,而不是 'finish' 是否已触发并刷新底层数据。

¥response.finished indicates whether response.end() has been called, not whether 'finish' has been emitted and the underlying data is flushed.

相应地使用 response.writableFinishedresponse.writableEnded 以避免歧义。

¥Use response.writableFinished or response.writableEnded accordingly instead to avoid the ambiguity.

为保持现有行为,response.finished 应替换为 response.writableEnded

¥To maintain existing behavior response.finished should be replaced with response.writableEnded.

DEP0137:在垃圾回收时关闭 fs.FileHandle#

¥DEP0137: Closing fs.FileHandle on garbage collection

类型:运行时

¥Type: Runtime

允许在垃圾回收时关闭 fs.FileHandle 对象已弃用。将来,这样做可能会导致抛出错误,从而终止进程。

¥Allowing a fs.FileHandle object to be closed on garbage collection is deprecated. In the future, doing so might result in a thrown error that will terminate the process.

请确保在不再需要 fs.FileHandle 时使用 FileHandle.prototype.close() 显式关闭所有 fs.FileHandle 对象:

¥Please ensure that all fs.FileHandle objects are explicitly closed using FileHandle.prototype.close() when the fs.FileHandle is no longer needed:

const fsPromises = require('node:fs').promises;
async function openAndClose() {
  let filehandle;
  try {
    filehandle = await fsPromises.open('thefile.txt', 'r');
  } finally {
    if (filehandle !== undefined)
      await filehandle.close();
  }
} 

DEP0138:process.mainModule#

类型:仅文档

¥Type: Documentation-only

process.mainModule 是 CommonJS 独有的特性,而 process 全局对象与非 CommonJS 环境共享。不支持在 ECMAScript 模块中使用它。

¥process.mainModule is a CommonJS-only feature while process global object is shared with non-CommonJS environment. Its use within ECMAScript modules is unsupported.

它已被弃用,取而代之的是 require.main,因为它具有相同的目的并且仅在 CommonJS 环境中可用。

¥It is deprecated in favor of require.main, because it serves the same purpose and is only available on CommonJS environment.

DEP0139:process.umask() 无参数#

¥DEP0139: process.umask() with no arguments

类型:仅文档

¥Type: Documentation-only

不带参数调用 process.umask() 会导致进程范围的 umask 被写入两次。这在线程之间引入了竞争条件,并且是一个潜在的安全漏洞。没有安全的、跨平台的替代 API。

¥Calling process.umask() with no argument causes the process-wide umask to be written twice. This introduces a race condition between threads, and is a potential security vulnerability. There is no safe, cross-platform alternative API.

DEP0140:使用 request.destroy() 代替 request.abort()#

¥DEP0140: Use request.destroy() instead of request.abort()

类型:仅文档

¥Type: Documentation-only

使用 request.destroy() 而不是 request.abort()

¥Use request.destroy() instead of request.abort().

DEP0141:repl.inputStreamrepl.outputStream#

¥DEP0141: repl.inputStream and repl.outputStream

类型:仅文档(支持 --pending-deprecation

¥Type: Documentation-only (supports --pending-deprecation)

node:repl 模块两次导出输入输出流。使用 .input 代替 .inputStream,使用 .output 代替 .outputStream

¥The node:repl module exported the input and output stream twice. Use .input instead of .inputStream and .output instead of .outputStream.

DEP0142:repl._builtinLibs#

类型:仅文档

¥Type: Documentation-only

node:repl 模块导出一个包含内置模块数组的 _builtinLibs 属性。到目前为止它还不完整,最好依赖 require('node:module').builtinModules

¥The node:repl module exports a _builtinLibs property that contains an array of built-in modules. It was incomplete so far and instead it's better to rely upon require('node:module').builtinModules.

DEP0143:Transform._transformState#

类型:Runtime Transform._transformState 将在以后的版本中删除,因为实现的简化不再需要它。

¥Type: Runtime Transform._transformState will be removed in future versions where it is no longer required due to simplification of the implementation.

DEP0144:module.parent#

类型:仅文档(支持 --pending-deprecation

¥Type: Documentation-only (supports --pending-deprecation)

CommonJS 模块可以使用 module.parent 访问需要它的第一个模块。此功能已被弃用,因为它在存在 ECMAScript 模块的情况下无法始终如一地工作,并且因为它给出了 CommonJS 模块图的不准确表示。

¥A CommonJS module can access the first module that required it using module.parent. This feature is deprecated because it does not work consistently in the presence of ECMAScript modules and because it gives an inaccurate representation of the CommonJS module graph.

一些模块使用它来检查它们是否是当前进程的入口点。相反,建议比较 require.mainmodule

¥Some modules use it to check if they are the entry point of the current process. Instead, it is recommended to compare require.main and module:

if (require.main === module) {
  // Code section that will run only if current file is the entry point.
} 

在查找需要当前模块的 CommonJS 模块时,可以使用 require.cachemodule.children

¥When looking for the CommonJS modules that have required the current one, require.cache and module.children can be used:

const moduleParents = Object.values(require.cache)
  .filter((m) => m.children.includes(module)); 

DEP0145:socket.bufferSize#

类型:仅文档

¥Type: Documentation-only

socket.bufferSize 只是 writable.writableLength 的别名。

¥socket.bufferSize is just an alias for writable.writableLength.

DEP0146:new crypto.Certificate()#

类型:仅文档

¥Type: Documentation-only

crypto.Certificate() 构造函数 已弃用。改用 crypto.Certificate() 的静态方法

¥The crypto.Certificate() constructor is deprecated. Use static methods of crypto.Certificate() instead.

DEP0147:fs.rmdir(path, { recursive: true })#

类型:运行时

¥Type: Runtime

在 Node.js 的未来版本中,fs.rmdirfs.rmdirSyncfs.promises.rmdir 将忽略 recursive 选项。

¥In future versions of Node.js, recursive option will be ignored for fs.rmdir, fs.rmdirSync, and fs.promises.rmdir.

请改用 fs.rm(path, { recursive: true, force: true })fs.rmSync(path, { recursive: true, force: true })fs.promises.rm(path, { recursive: true, force: true })

¥Use fs.rm(path, { recursive: true, force: true }), fs.rmSync(path, { recursive: true, force: true }) or fs.promises.rm(path, { recursive: true, force: true }) instead.

DEP0148:"exports"(尾随 "/")中的文件夹映射#

¥DEP0148: Folder mappings in "exports" (trailing "/")

类型:运行时

¥Type: Runtime

使用尾随 "/"子路径导出子路径导入 字段中定义子路径文件夹映射已被弃用。改用 子路径模式

¥Using a trailing "/" to define subpath folder mappings in the subpath exports or subpath imports fields is deprecated. Use subpath patterns instead.

DEP0149:http.IncomingMessage#connection#

类型:仅文档。

¥Type: Documentation-only.

message.connection 更喜欢 message.socket

¥Prefer message.socket over message.connection.

DEP0150:更改 process.config 的值#

¥DEP0150: Changing the value of process.config

类型:生命结束

¥Type: End-of-Life

process.config 属性提供对 Node.js 编译时设置的访问。但是,该属性是可变的,因此容易被篡改。更改值的功能将在 Node.js 的未来版本中删除。

¥The process.config property provides access to Node.js compile-time settings. However, the property is mutable and therefore subject to tampering. The ability to change the value will be removed in a future version of Node.js.

DEP0151:主索引查找和扩展搜索#

¥DEP0151: Main index lookup and extension searching

类型:运行时

¥Type: Runtime

以前,index.js 和扩展搜索查找将应用于 import 'pkg' 主入口点解析,即使在解析 ES 模块时也是如此。

¥Previously, index.js and extension searching lookups would apply to import 'pkg' main entry point resolution, even when resolving ES modules.

通过此弃用,所有 ES 模块主入口点解析都需要具有确切文件扩展名的显式 "exports""main" 条目

¥With this deprecation, all ES module main entry point resolutions require an explicit "exports" or "main" entry with the exact file extension.

DEP0152:扩展 PerformanceEntry 属性#

¥DEP0152: Extension PerformanceEntry properties

类型:运行时

¥Type: Runtime

'gc''http2''http' <PerformanceEntry> 对象类型具有分配给它们的附加属性以提供附加信息。这些属性现在在 PerformanceEntry 对象的标准 detail 属性中可用。现有访问器已被弃用,不应再使用。

¥The 'gc', 'http2', and 'http' <PerformanceEntry> object types have additional properties assigned to them that provide additional information. These properties are now available within the standard detail property of the PerformanceEntry object. The existing accessors have been deprecated and should no longer be used.

DEP0153:dns.lookupdnsPromises.lookup 选项类型强制#

¥DEP0153: dns.lookup and dnsPromises.lookup options type coercion

类型:生命结束

¥Type: End-of-Life

family 选项使用非无效非整数值,对 hints 选项使用非无效非数字值,对 all 选项使用非无效非布尔值,或对 verbatim 选项使用非无效非布尔值 dns.lookup()dnsPromises.lookup() 引发 ERR_INVALID_ARG_TYPE 错误。

¥Using a non-nullish non-integer value for family option, a non-nullish non-number value for hints option, a non-nullish non-boolean value for all option, or a non-nullish non-boolean value for verbatim option in dns.lookup() and dnsPromises.lookup() throws an ERR_INVALID_ARG_TYPE error.

DEP0154:RSA-PSS 生成密钥对选项#

¥DEP0154: RSA-PSS generate key pair options

类型:运行时

¥Type: Runtime

'hash''mgf1Hash' 选项已替换为 'hashAlgorithm''mgf1HashAlgorithm'

¥The 'hash' and 'mgf1Hash' options are replaced with 'hashAlgorithm' and 'mgf1HashAlgorithm'.

DEP0155:模式说明符解析中的尾部斜杠#

¥DEP0155: Trailing slashes in pattern specifier resolutions

类型:运行时

¥Type: Runtime

对于包 "exports""imports" 模式解析,不推荐重新映射以 "/" 结尾的说明符(如 import 'pkg/x/')。

¥The remapping of specifiers ending in "/" like import 'pkg/x/' is deprecated for package "exports" and "imports" pattern resolutions.

DEP0156:http 中的 .aborted 属性和 'abort''aborted' 事件#

¥DEP0156: .aborted property and 'abort', 'aborted' event in http

类型:仅文档

¥Type: Documentation-only

改用 <Stream> API,因为 http.ClientRequesthttp.ServerResponsehttp.IncomingMessage 都是基于流的。检查 stream.destroyed 而不是 .aborted 属性,并监听 'close' 而不是 'abort''aborted' 事件。

¥Move to <Stream> API instead, as the http.ClientRequest, http.ServerResponse, and http.IncomingMessage are all stream-based. Check stream.destroyed instead of the .aborted property, and listen for 'close' instead of 'abort', 'aborted' event.

.aborted 属性和 'abort' 事件仅对检测 .abort() 调用有用。要提前关闭请求,请使用 Stream .destroy([error]),然后检查 .destroyed 属性和 'close' 事件应该具有相同的效果。接收端还应该检查 http.IncomingMessage 上的 readable.readableEnded 值,以确定它是中止的还是正常的销毁。

¥The .aborted property and 'abort' event are only useful for detecting .abort() calls. For closing a request early, use the Stream .destroy([error]) then check the .destroyed property and 'close' event should have the same effect. The receiving end should also check the readable.readableEnded value on http.IncomingMessage to get whether it was an aborted or graceful destroy.

DEP0157:流中的可线程支持#

¥DEP0157: Thenable support in streams

类型:生命结束

¥Type: End-of-Life

Node.js 流的一个未记录的特性是在实现方法中支持 thenables。现在已弃用,请改用回调并避免对流实现方法使用异步函数。

¥An undocumented feature of Node.js streams was to support thenables in implementation methods. This is now deprecated, use callbacks instead and avoid use of async function for streams implementation methods.

此功能导致用户遇到意想不到的问题,即用户以回调方式实现功能但使用例如 一个会导致错误的异步方法,因为混合 promise 和回调语义是无效的。

¥This feature caused users to encounter unexpected problems where the user implements the function in callback style but uses e.g. an async method which would cause an error since mixing promise and callback semantics is not valid.

const w = new Writable({
  async final(callback) {
    await someOp();
    callback();
  },
}); 

DEP0158:buffer.slice(start, end)#

类型:仅文档

¥Type: Documentation-only

此方法已被弃用,因为它与 Uint8Array.prototype.slice() 不兼容,Uint8Array.prototype.slice()Buffer 的超类。

¥This method was deprecated because it is not compatible with Uint8Array.prototype.slice(), which is a superclass of Buffer.

使用 buffer.subarray 来代替做同样的事情。

¥Use buffer.subarray which does the same thing instead.

DEP0159:ERR_INVALID_CALLBACK#

类型:生命结束

¥Type: End-of-Life

由于对用于值类型验证的错误增加了更多混淆,因此删除了此错误代码。

¥This error code was removed due to adding more confusion to the errors used for value type validation.

DEP0160:process.on('multipleResolves', handler)#

类型:运行。

¥Type: Runtime.

此事件已弃用,因为它不适用于 V8 promise 组合器,这降低了它的用处。

¥This event was deprecated because it did not work with V8 promise combinators which diminished its usefulness.

DEP0161:process._getActiveRequests()process._getActiveHandles()#

¥DEP0161: process._getActiveRequests() and process._getActiveHandles()

类型:仅文档

¥Type: Documentation-only

process._getActiveHandles()process._getActiveRequests() 函数不供公众使用,可以在未来的版本中删除。

¥The process._getActiveHandles() and process._getActiveRequests() functions are not intended for public use and can be removed in future releases.

使用 process.getActiveResourcesInfo() 获取活动资源类型列表,而不是实际引用。

¥Use process.getActiveResourcesInfo() to get a list of types of active resources and not the actual references.

DEP0162:fs.write(), fs.writeFileSync() 强制转换为字符串#

¥DEP0162: fs.write(), fs.writeFileSync() coercion to string

类型:生命结束

¥Type: End-of-Life

不推荐使用 fs.write()fs.writeFile()fs.appendFile()fs.writeFileSync()fs.appendFileSync() 中作为第二个参数传递的具有自己的 toString 属性的对象的隐式强制转换。将它们转换为原始字符串。

¥Implicit coercion of objects with own toString property, passed as second parameter in fs.write(), fs.writeFile(), fs.appendFile(), fs.writeFileSync(), and fs.appendFileSync() is deprecated. Convert them to primitive strings.

DEP0163:channel.subscribe(onMessage), channel.unsubscribe(onMessage)#

类型:仅文档

¥Type: Documentation-only

这些方法已被弃用,因为它们的使用方式不会使通道引用保持足够长的时间以接收事件。

¥These methods were deprecated because they can be used in a way which does not hold the channel reference alive long enough to receive the events.

使用做同样事情的 diagnostics_channel.subscribe(name, onMessage)diagnostics_channel.unsubscribe(name, onMessage)

¥Use diagnostics_channel.subscribe(name, onMessage) or diagnostics_channel.unsubscribe(name, onMessage) which does the same thing instead.

DEP0164:process.exit(code), process.exitCode 强制转换为整数#

¥DEP0164: process.exit(code), process.exitCode coercion to integer

类型:生命结束

¥Type: End-of-Life

undefinednull、整数和整数字符串(例如,'1')以外的值作为 process.exit()code 参数的值以及分配给 process.exitCode 的值已弃用。

¥Values other than undefined, null, integer numbers, and integer strings (e.g., '1') are deprecated as value for the code parameter in process.exit() and as value to assign to process.exitCode.

DEP0165:--trace-atomics-wait#

类型:仅文档

¥Type: Documentation-only

--trace-atomics-wait 标志已弃用。

¥The --trace-atomics-wait flag is deprecated.

DEP0166:导入和导出目标中的双斜线#

¥DEP0166: Double slashes in imports and exports targets

类型:运行时

¥Type: Runtime

映射到包含双斜杠("/" 或 "")的路径的包导入和导出目标已弃用,并且在未来的版本中将失败并出现解析验证错误。同样的弃用也适用于以斜杠开头或结尾的模式匹配。

¥Package imports and exports targets mapping into paths including a double slash (of "/" or "") are deprecated and will fail with a resolution validation error in a future release. This same deprecation also applies to pattern matches starting or ending in a slash.

DEP0167:弱 DiffieHellmanGroup 实例(modp1modp2modp5#

¥DEP0167: Weak DiffieHellmanGroup instances (modp1, modp2, modp5)

类型:仅文档

¥Type: Documentation-only

著名的 MODP 组 modp1modp2modp5 已弃用,因为它们无法抵御实际攻击。详见 RFC 8247 第 2.4 节

¥The well-known MODP groups modp1, modp2, and modp5 are deprecated because they are not secure against practical attacks. See RFC 8247 Section 2.4 for details.

这些组可能会在 Node.js 的未来版本中被删除。依赖这些组的应用应该使用更强大的 MODP 组进行评估。

¥These groups might be removed in future versions of Node.js. Applications that rely on these groups should evaluate using stronger MODP groups instead.

DEP0168:Node-API 回调中未处理的异常#

¥DEP0168: Unhandled exception in Node-API callbacks

类型:运行时

¥Type: Runtime

Node-API 回调中未捕获异常的隐式抑制现已弃用。

¥The implicit suppression of uncaught exceptions in Node-API callbacks is now deprecated.

如果异常未在 Node-API 回调中处理,则设置标志 --force-node-api-uncaught-exceptions-policy 以强制 Node.js 触发 'uncaughtException' 事件。

¥Set the flag --force-node-api-uncaught-exceptions-policy to force Node.js to emit an 'uncaughtException' event if the exception is not handled in Node-API callbacks.

DEP0169:不安全的 url.parse()#

¥DEP0169: Insecure url.parse()

类型:仅文档(支持 --pending-deprecation

¥Type: Documentation-only (supports --pending-deprecation)

url.parse() 行为不规范,容易出现具有安全隐患的错误。请改用 WHATWG URL API。不针对 url.parse() 漏洞发布 CVE。

¥url.parse() behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for url.parse() vulnerabilities.

DEP0170:使用 url.parse() 时端口无效#

¥DEP0170: Invalid port when using url.parse()

类型:运行时

¥Type: Runtime

url.parse() 接受端口不是数字的 URL。此行为可能会导致使用意外输入进行主机名欺骗。这些 URL 将在未来版本的 Node.js 中抛出错误,就像 WHATWG URL API 已经做的那样。

¥url.parse() accepts URLs with ports that are not numbers. This behavior might result in host name spoofing with unexpected input. These URLs will throw an error in future versions of Node.js, as the WHATWG URL API does already.

DEP0171:适用于 http.IncomingMessage 标头和标尾的设置器#

¥DEP0171: Setters for http.IncomingMessage headers and trailers

类型:仅文档

¥Type: Documentation-only

在 Node.js 的未来版本中,message.headersmessage.headersDistinctmessage.trailersmessage.trailersDistinct 将是只读的。

¥In a future version of Node.js, message.headers, message.headersDistinct, message.trailers, and message.trailersDistinct will be read-only.

DEP0172:AsyncResource 绑定函数的 asyncResource 属性#

¥DEP0172: The asyncResource property of AsyncResource bound functions

类型:运行时

¥Type: Runtime

在未来的 Node.js 版本中,当函数绑定到 AsyncResource 时,将不再添加 asyncResource 属性。

¥In a future version of Node.js, the asyncResource property will no longer be added when a function is bound to an AsyncResource.

DEP0173:assert.CallTracker#

¥DEP0173: the assert.CallTracker class

类型:仅文档

¥Type: Documentation-only

在 Node.js 的未来版本中,assert.CallTracker 将被删除。考虑使用替代方法,例如 mock 辅助函数。

¥In a future version of Node.js, assert.CallTracker, will be removed. Consider using alternatives such as the mock helper function.

DEP0174:在返回 Promise 的函数上调用 promisify#

¥DEP0174: calling promisify on a function that returns a Promise

类型:仅文档

¥Type: Documentation-only

在返回 的函数上调用 util.promisify 将忽略所述 Promise 的结果,这可能导致未处理的 Promise 拒绝。

¥Calling util.promisify on a function that returns a will ignore the result of said promise, which can lead to unhandled promise rejections.

DEP0175:util.toUSVString#

类型:仅文档

¥Type: Documentation-only

util.toUSVString() API 已弃用。请改用 String.prototype.toWellFormed

¥The util.toUSVString() API is deprecated. Please use String.prototype.toWellFormed instead.

DEP0176:fs.F_OK, fs.R_OK, fs.W_OK, fs.X_OK#

类型:仅文档

¥Type: Documentation-only

直接暴露在 node:fs 上的 F_OKR_OKW_OKX_OK getter 已被弃用。请从 fs.constantsfs.promises.constants 获取。

¥F_OK, R_OK, W_OK and X_OK getters exposed directly on node:fs are deprecated. Get them from fs.constants or fs.promises.constants instead.

DEP0177:util.types.isWebAssemblyCompiledModule#

类型:仅文档

¥Type: Documentation-only

util.types.isWebAssemblyCompiledModule API 已弃用。请改用 value instanceof WebAssembly.Module

¥The util.types.isWebAssemblyCompiledModule API is deprecated. Please use value instanceof WebAssembly.Module instead.