Deprecated APIs

<!--introduced_in=v7.7.0-->

<!-- type=misc -->

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

  • Use of the API is unsafe.
  • An improved alternative API is available.
  • Breaking changes to the API are expected in a future major release.

Node.js uses four kinds of deprecations:

  • Documentation-only
  • Application (non-node_modules code only)
  • Runtime (all code)
  • End-of-Life

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.

An Application deprecation for only non-node_modules code will, by default, generate a process warning that will be printed to stderr the first time the deprecated API is used in code that's not loaded from node_modules. When the [--throw-deprecation][] command-line flag is used, a Runtime deprecation will cause an error to be thrown. When [--pending-deprecation][] is used, warnings will also be emitted for code loaded from node_modules.

A runtime deprecation for all code is similar to the runtime deprecation for non-node_modules code, except that it also emits a warning for code loaded from node_modules.

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

Revoking deprecations

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.

List of deprecated APIs

DEP0001: http.OutgoingMessage.prototype.flush

<!-- YAML changes: - version: v14.0.0 pr-url: https://github.com/nodejs/node/pull/31164 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v1.6.0 pr-url: https://github.com/nodejs/node/pull/1156 description: Runtime deprecation. -->

Type: End-of-Life

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

<!-- YAML changes: - version: v8.0.0 pr-url: https://github.com/nodejs/node/pull/12113 description: End-of-Life. - version: v6.12.0 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v5.0.0 pr-url: https://github.com/nodejs/node/pull/3078 description: Runtime deprecation. -->

Type: End-of-Life

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

DEP0003: _writableState.buffer

<!-- YAML changes: - version: v14.0.0 pr-url: https://github.com/nodejs/node/pull/31165 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.11.15 pr-url: https://github.com/nodejs/node-v0.x-archive/pull/8826 description: Runtime deprecation. -->

Type: End-of-Life

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

DEP0004: CryptoStream.prototype.readyState

<!-- YAML changes: - version: v10.0.0 pr-url: https://github.com/nodejs/node/pull/17882 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.4.0 commit: 9c7f89bf56abd37a796fea621ad2e47dd33d2b82 description: Documentation-only deprecation. -->

Type: End-of-Life

The CryptoStream.prototype.readyState property was removed.

DEP0005: Buffer() constructor

<!-- YAML changes: - version: v10.0.0 pr-url: https://github.com/nodejs/node/pull/19524 description: Runtime deprecation. - version: v6.12.0 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v6.0.0 pr-url: https://github.com/nodejs/node/pull/4682 description: Documentation-only deprecation. -->

Type: Application (non-node_modules code only)

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

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

  • [Buffer.alloc(size[, fill[, encoding]])][alloc]: Create a Buffer with initialized memory.
  • [Buffer.allocUnsafe(size)][alloc_unsafe_size]: Create a Buffer with uninitialized memory.
  • [Buffer.allocUnsafeSlow(size)][]: Create a Buffer with uninitialized memory.
  • [Buffer.from(array)][]: Create a Buffer with a copy of array
  • [Buffer.from(arrayBuffer[, byteOffset[, length]])][from_arraybuffer] - Create a Buffer that wraps the given arrayBuffer.
  • [Buffer.from(buffer)][]: Create a Buffer that copies buffer.
  • [Buffer.from(string[, encoding])][from_string_encoding]: Create a Buffer that copies string.

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

<!-- YAML changes: - version: v12.0.0 pr-url: https://github.com/nodejs/node/pull/25279 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.11.14 description: Runtime deprecation. - version: v0.5.10 description: Documentation-only deprecation. -->

Type: End-of-Life

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: Replace cluster worker.suicide with worker.exitedAfterDisconnect

<!-- YAML changes: - version: v9.0.0 pr-url: https://github.com/nodejs/node/pull/13702 description: End-of-Life. - version: v7.0.0 pr-url: https://github.com/nodejs/node/pull/3747 description: Runtime deprecation. - version: v6.12.0 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v6.0.0 pr-url: https://github.com/nodejs/node/pull/3743 description: Documentation-only deprecation. -->

Type: End-of-Life

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')

<!-- YAML changes: - version: v6.12.0 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v6.3.0 pr-url: https://github.com/nodejs/node/pull/6534 description: Documentation-only deprecation. -->

Type: Documentation-only

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 without digest

<!-- YAML changes: - version: v14.0.0 pr-url: https://github.com/nodejs/node/pull/31166 description: End-of-Life (for digest === null). - version: v11.0.0 pr-url: https://github.com/nodejs/node/pull/22861 description: Runtime deprecation (for digest === null). - version: v8.0.0 pr-url: https://github.com/nodejs/node/pull/11305 description: End-of-Life (for digest === undefined). - version: v6.12.0 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v6.0.0 pr-url: https://github.com/nodejs/node/pull/4047 description: Runtime deprecation (for digest === undefined). -->

Type: End-of-Life

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.

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

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

DEP0010: crypto.createCredentials

<!-- YAML changes: - version: v11.0.0 pr-url: https://github.com/nodejs/node/pull/21153 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.11.13 pr-url: https://github.com/nodejs/node-v0.x-archive/pull/7265 description: Runtime deprecation. -->

Type: End-of-Life

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

DEP0011: crypto.Credentials

<!-- YAML changes: - version: v11.0.0 pr-url: https://github.com/nodejs/node/pull/21153 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.11.13 pr-url: https://github.com/nodejs/node-v0.x-archive/pull/7265 description: Runtime deprecation. -->

Type: End-of-Life

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

DEP0012: Domain.dispose

<!-- YAML changes: - version: v9.0.0 pr-url: https://github.com/nodejs/node/pull/15412 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.11.7 pr-url: https://github.com/nodejs/node-v0.x-archive/pull/5021 description: Runtime deprecation. -->

Type: End-of-Life

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

DEP0013: fs asynchronous function without callback

<!-- YAML changes: - version: v10.0.0 pr-url: https://github.com/nodejs/node/pull/18668 description: End-of-Life. - version: v7.0.0 pr-url: https://github.com/nodejs/node/pull/7897 description: Runtime deprecation. -->

Type: End-of-Life

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 legacy String interface

<!-- YAML changes: - version: v8.0.0 pr-url: https://github.com/nodejs/node/pull/9683 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v6.0.0 pr-url: https://github.com/nodejs/node/pull/4525 description: Runtime deprecation. - version: v0.1.96 commit: c93e0aaf062081db3ec40ac45b3e2c979d5759d6 description: Documentation-only deprecation. -->

Type: End-of-Life

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

DEP0015: fs.readSync legacy String interface

<!-- YAML changes: - version: v8.0.0 pr-url: https://github.com/nodejs/node/pull/9683 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v6.0.0 pr-url: https://github.com/nodejs/node/pull/4525 description: Runtime deprecation. - version: v0.1.96 commit: c93e0aaf062081db3ec40ac45b3e2c979d5759d6 description: Documentation-only deprecation. -->

Type: End-of-Life

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

DEP0016: GLOBAL/root

<!-- YAML changes: - version: v14.0.0 pr-url: https://github.com/nodejs/node/pull/31167 description: End-of-Life. - version: v6.12.0 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v6.0.0 pr-url: https://github.com/nodejs/node/pull/1838 description: Runtime deprecation. -->

Type: End-of-Life

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

<!-- YAML changes: - version: v9.0.0 pr-url: https://github.com/nodejs/node/pull/15238 description: End-of-Life. - version: v7.0.0 pr-url: https://github.com/nodejs/node/pull/8908 description: Runtime deprecation. -->

Type: End-of-Life

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

DEP0018: Unhandled promise rejections

<!-- YAML changes: - version: v15.0.0 pr-url: https://github.com/nodejs/node/pull/35316 description: End-of-Life. - version: v7.0.0 pr-url: https://github.com/nodejs/node/pull/8217 description: Runtime deprecation. -->

Type: End-of-Life

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('.') resolved outside directory

<!-- YAML changes: - version: v12.0.0 pr-url: https://github.com/nodejs/node/pull/26973 description: Removed functionality. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v1.8.1 pr-url: https://github.com/nodejs/node/pull/1363 description: Runtime deprecation. -->

Type: End-of-Life

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

DEP0020: Server.connections

<!-- YAML changes: - version: v15.0.0 pr-url: https://github.com/nodejs/node/pull/33647 description: Server.connections has been removed. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.9.7 pr-url: https://github.com/nodejs/node-v0.x-archive/pull/4595 description: Runtime deprecation. -->

Type: End-of-Life

The Server.connections property was deprecated in Node.js 0.9.7 and has been removed. Please use the [Server.getConnections()][] method instead.

DEP0021: Server.listenFD

<!-- YAML changes: - version: v12.0.0 pr-url: https://github.com/nodejs/node/pull/27127 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.7.12 commit: 41421ff9da1288aa241a5e9dcf915b685ade1c23 description: Runtime deprecation. -->

Type: End-of-Life

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

DEP0022: os.tmpDir()

<!-- YAML changes: - version: v14.0.0 pr-url: https://github.com/nodejs/node/pull/31169 description: End-of-Life. - version: v7.0.0 pr-url: https://github.com/nodejs/node/pull/6739 description: Runtime deprecation. -->

Type: End-of-Life

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

An automated migration is available (source):

npx codemod@latest @nodejs/tmpDir-to-tmpdir

DEP0023: os.getNetworkInterfaces()

<!-- YAML changes: - version: v12.0.0 pr-url: https://github.com/nodejs/node/pull/25280 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.6.0 commit: 37bb37d151fb6ee4696730e63ff28bb7a4924f97 description: Runtime deprecation. -->

Type: End-of-Life

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

DEP0024: REPLServer.prototype.convertToContext()

<!-- YAML changes: - version: v9.0.0 pr-url: https://github.com/nodejs/node/pull/13434 description: End-of-Life. - version: v7.0.0 pr-url: https://github.com/nodejs/node/pull/7829 description: Runtime deprecation. -->

Type: End-of-Life

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

DEP0025: require('node:sys')

<!-- YAML changes: - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v1.0.0 pr-url: https://github.com/nodejs/node/pull/317 description: Runtime deprecation. -->

Type: Runtime

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

DEP0026: util.print()

<!-- YAML changes: - version: v12.0.0 pr-url: https://github.com/nodejs/node/pull/25377 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.11.3 commit: 896b2aa7074fc886efd7dd0a397d694763cac7ce description: Runtime deprecation. -->

Type: End-of-Life

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

An automated migration is available (source):

npx codemod@latest @nodejs/util-print-to-console-log

DEP0027: util.puts()

<!-- YAML changes: - version: v12.0.0 pr-url: https://github.com/nodejs/node/pull/25377 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.11.3 commit: 896b2aa7074fc886efd7dd0a397d694763cac7ce description: Runtime deprecation. -->

Type: End-of-Life

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

An automated migration is available (source):

npx codemod@latest @nodejs/util-print-to-console-log

DEP0028: util.debug()

<!-- YAML changes: - version: v12.0.0 pr-url: https://github.com/nodejs/node/pull/25377 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.11.3 commit: 896b2aa7074fc886efd7dd0a397d694763cac7ce description: Runtime deprecation. -->

Type: End-of-Life

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

An automated migration is available (source):

npx codemod@latest @nodejs/util-print-to-console-log

DEP0029: util.error()

<!-- YAML changes: - version: v12.0.0 pr-url: https://github.com/nodejs/node/pull/25377 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.11.3 commit: 896b2aa7074fc886efd7dd0a397d694763cac7ce description: Runtime deprecation. -->

Type: End-of-Life

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

An automated migration is available (source):

npx codemod@latest @nodejs/util-print-to-console-log

DEP0030: SlowBuffer

<!-- YAML changes: - version: v25.0.0 pr-url: https://github.com/nodejs/node/pull/58220 description: End-of-Life. - version: v24.0.0 pr-url: https://github.com/nodejs/node/pull/55175 description: Runtime deprecation. - version: v6.12.0 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v6.0.0 pr-url: https://github.com/nodejs/node/pull/5833 description: Documentation-only deprecation. -->

Type: End-of-Life

The SlowBuffer class has been removed. Please use [Buffer.allocUnsafeSlow(size)][] instead.

An automated migration is available (source).

npx codemod@latest @nodejs/slow-buffer-to-buffer-alloc-unsafe-slow

DEP0031: ecdh.setPublicKey()

<!-- YAML changes: - version: v25.0.0 pr-url: https://github.com/nodejs/node/pull/58620 description: Runtime deprecation. - version: v6.12.0 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v5.2.0 pr-url: https://github.com/nodejs/node/pull/3511 description: Documentation-only deprecation. -->

Type: Runtime

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

DEP0032: node:domain module

<!-- YAML changes: - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v1.4.2 pr-url: https://github.com/nodejs/node/pull/943 description: Documentation-only deprecation. -->

Type: Documentation-only

The [domain][] module is deprecated and should not be used.

DEP0033: EventEmitter.listenerCount()

<!-- YAML changes: - version: - v25.4.0 - v24.14.0 pr-url: https://github.com/nodejs/node/pull/60214 description: Deprecation revoked. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v3.2.0 pr-url: https://github.com/nodejs/node/pull/2349 description: Documentation-only deprecation. -->

Type: Revoked

The [events.listenerCount(emitter, eventName)][] API was deprecated, as it provided identical functionality to [emitter.listenerCount(eventName)][]. The deprecation was revoked because this function has been repurposed to also accept {EventTarget} arguments.

DEP0034: fs.exists(path, callback)

<!-- YAML changes: - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v1.0.0 pr-url: https://github.com/nodejs/node/pull/166 description: Documentation-only deprecation. -->

Type: Documentation-only

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

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

<!-- YAML changes: - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.4.7 description: Documentation-only deprecation. -->

Type: Documentation-only

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

DEP0036: fs.lchmodSync(path, mode)

<!-- YAML changes: - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.4.7 description: Documentation-only deprecation. -->

Type: Documentation-only

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

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

<!-- YAML changes: - version: v10.6.0 pr-url: https://github.com/nodejs/node/pull/21498 description: Deprecation revoked. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.4.7 description: Documentation-only deprecation. -->

Type: Deprecation revoked

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)

<!-- YAML changes: - version: v10.6.0 pr-url: https://github.com/nodejs/node/pull/21498 description: Deprecation revoked. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.4.7 description: Documentation-only deprecation. -->

Type: Deprecation revoked

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

<!-- YAML changes: - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.10.6 commit: 7bd8a5a2a60b75266f89f9a32877d55294a3881c description: Documentation-only deprecation. -->

Type: Documentation-only

The [require.extensions][] property is deprecated.

DEP0040: node:punycode module

<!-- YAML changes: - version: - v23.7.0 - v22.14.0 pr-url: https://github.com/nodejs/node/pull/56632 description: Application deprecation. - version: v21.0.0 pr-url: https://github.com/nodejs/node/pull/47202 description: Runtime deprecation. - version: v16.6.0 pr-url: https://github.com/nodejs/node/pull/38444 description: Added support for --pending-deprecation. - version: v7.0.0 pr-url: https://github.com/nodejs/node/pull/7941 description: Documentation-only deprecation. -->

Type: Application (non-node_modules code only)

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

DEP0041: NODE_REPL_HISTORY_FILE environment variable

<!-- YAML changes: - version: v10.0.0 pr-url: https://github.com/nodejs/node/pull/13876 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v3.0.0 pr-url: https://github.com/nodejs/node/pull/2224 description: Documentation-only deprecation. -->

Type: End-of-Life

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

DEP0042: tls.CryptoStream

<!-- YAML changes: - version: v10.0.0 pr-url: https://github.com/nodejs/node/pull/17882 description: End-of-Life. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v0.11.3 commit: af80e7bc6e6f33c582eb1f7d37c7f5bbe9f910f7 description: Documentation-only deprecation. -->

Type: End-of-Life

The tls.CryptoStream class was removed. Please use [tls.TLSSocket][] instead.

DEP0043: tls.SecurePair

<!-- YAML changes: - version: v24.0.0 pr-url: https://github.com/nodejs/node/pull/57361 description: End-of-Life. - version: v8.0.0 pr-url: https://github.com/nodejs/node/pull/11349 description: Runtime deprecation. - version: v6.12.0 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v6.0.0 pr-url: https://github.com/nodejs/node/pull/6063 description: Documentation-only deprecation. - version: v0.11.15 pr-url: - https://github.com/nodejs/node-v0.x-archive/pull/8695 - https://github.com/nodejs/node-v0.x-archive/pull/8700 description: Deprecation revoked. - version: v0.11.3 commit: af80e7bc6e6f33c582eb1f7d37c7f5bbe9f910f7 description: Runtime deprecation. -->

Type: End-of-Life

The tls.SecurePair class is deprecated. Please use [tls.TLSSocket][] instead.

DEP0044: util.isArray()

<!-- YAML changes: - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: - v4.0.0 - v3.3.1 pr-url: https://github.com/nodejs/node/pull/2447 description: Documentation-only deprecation. -->

Type: Runtime

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

An automated migration is available (source):

npx codemod@latest @nodejs/util-is

DEP0045: util.isBoolean()

<!-- YAML changes: - version: v23.0.0 pr-url: https://github.com/nodejs/node/pull/52744 description: End-of-Life deprecation. - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: - v4.0.0 - v3.3.1 pr-url: https://github.com/nodejs/node/pull/2447 description: Documentation-only deprecation. -->

Type: End-of-Life

The util.isBoolean() API has been removed. Please use typeof arg === 'boolean' instead.

An automated migration is available (source):

npx codemod@latest @nodejs/util-is

DEP0046: util.isBuffer()

<!-- YAML changes: - version: v23.0.0 pr-url: https://github.com/nodejs/node/pull/52744 description: End-of-Life deprecation. - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: - v4.0.0 - v3.3.1 pr-url: https://github.com/nodejs/node/pull/2447 description: Documentation-only deprecation. -->

Type: End-of-Life

The util.isBuffer() API has been removed. Please use [Buffer.isBuffer()][] instead.

An automated migration is available (source):

npx codemod@latest @nodejs/util-is

DEP0047: util.isDate()

<!-- YAML changes: - version: v23.0.0 pr-url: https://github.com/nodejs/node/pull/52744 description: End-of-Life deprecation. - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: - v4.0.0 - v3.3.1 pr-url: https://github.com/nodejs/node/pull/2447 description: Documentation-only deprecation. -->

Type: End-of-Life

The util.isDate() API has been removed. Please use arg instanceof Date instead.

Also for stronger approaches, consider using: Date.prototype.toString.call(arg) === '[object Date]' && !isNaN(arg). This can also be used in a try/catch block to handle invalid date objects.

An automated migration is available (source):

npx codemod@latest @nodejs/util-is

DEP0048: util.isError()

<!-- YAML changes: - version: v23.0.0 pr-url: https://github.com/nodejs/node/pull/52744 description: End-of-Life deprecation. - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: - v4.0.0 - v3.3.1 pr-url: https://github.com/nodejs/node/pull/2447 description: Documentation-only deprecation. -->

Type: End-of-Life

The util.isError() API has been removed. Please use Error.isError(arg).

An automated migration is available (source):

npx codemod@latest @nodejs/util-is

DEP0049: util.isFunction()

<!-- YAML changes: - version: v23.0.0 pr-url: https://github.com/nodejs/node/pull/52744 description: End-of-Life deprecation. - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: - v4.0.0 - v3.3.1 pr-url: https://github.com/nodejs/node/pull/2447 description: Documentation-only deprecation. -->

Type: End-of-Life

The util.isFunction() API has been removed. Please use typeof arg === 'function' instead.

An automated migration is available (source):

npx codemod@latest @nodejs/util-is

DEP0050: util.isNull()

<!-- YAML changes: - version: v23.0.0 pr-url: https://github.com/nodejs/node/pull/52744 description: End-of-Life deprecation. - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: - v4.0.0 - v3.3.1 pr-url: https://github.com/nodejs/node/pull/2447 description: Documentation-only deprecation. -->

Type: End-of-Life

The util.isNull() API has been removed. Please use arg === null instead.

An automated migration is available (source):

npx codemod@latest @nodejs/util-is

DEP0051: util.isNullOrUndefined()

<!-- YAML changes: - version: v23.0.0 pr-url: https://github.com/nodejs/node/pull/52744 description: End-of-Life deprecation. - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: - v4.0.0 - v3.3.1 pr-url: https://github.com/nodejs/node/pull/2447 description: Documentation-only deprecation. -->

Type: End-of-Life

The util.isNullOrUndefined() API has been removed. Please use arg === null || arg === undefined instead.

An automated migration is available (source):

npx codemod@latest @nodejs/util-is

DEP0052: util.isNumber()

<!-- YAML changes: - version: v23.0.0 pr-url: https://github.com/nodejs/node/pull/52744 description: End-of-Life deprecation. - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: - v4.0.0 - v3.3.1 pr-url: https://github.com/nodejs/node/pull/2447 description: Documentation-only deprecation. -->

Type: End-of-Life

The util.isNumber() API has been removed. Please use typeof arg === 'number' instead.

An automated migration is available (source):

npx codemod@latest @nodejs/util-is

DEP0053: util.isObject()

<!-- YAML changes: - version: v23.0.0 pr-url: https://github.com/nodejs/node/pull/52744 description: End-of-Life deprecation. - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: - v4.0.0 - v3.3.1 pr-url: https://github.com/nodejs/node/pull/2447 description: Documentation-only deprecation. -->

Type: End-of-Life

The util.isObject() API has been removed. Please use arg && typeof arg === 'object' instead.

An automated migration is available (source):

npx codemod@latest @nodejs/util-is

DEP0054: util.isPrimitive()

<!-- YAML changes: - version: v23.0.0 pr-url: https://github.com/nodejs/node/pull/52744 description: End-of-Life deprecation. - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: - v4.0.0 - v3.3.1 pr-url: https://github.com/nodejs/node/pull/2447 description: Documentation-only deprecation. -->

Type: End-of-Life

The util.isPrimitive() API has been removed. Please use Object(arg) !== arg instead.

An automated migration is available (source):

npx codemod@latest @nodejs/util-is

DEP0055: util.isRegExp()

<!-- YAML changes: - version: v23.0.0 pr-url: https://github.com/nodejs/node/pull/52744 description: End-of-Life deprecation. - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: - v4.0.0 - v3.3.1 pr-url: https://github.com/nodejs/node/pull/2447 description: Documentation-only deprecation. -->

Type: End-of-Life

The util.isRegExp() API has been removed. Please use arg instanceof RegExp instead.

An automated migration is available (source):

npx codemod@latest @nodejs/util-is

DEP0056: util.isString()

<!-- YAML changes: - version: v23.0.0 pr-url: https://github.com/nodejs/node/pull/52744 description: End-of-Life deprecation. - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: - v4.0.0 - v3.3.1 pr-url: https://github.com/nodejs/node/pull/2447 description: Documentation-only deprecation. -->

Type: End-of-Life

The util.isString() API has been removed. Please use typeof arg === 'string' instead.

An automated migration is available (source):

npx codemod@latest @nodejs/util-is

DEP0057: util.isSymbol()

<!-- YAML changes: - version: v23.0.0 pr-url: https://github.com/nodejs/node/pull/52744 description: End-of-Life deprecation. - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: - v4.0.0 - v3.3.1 pr-url: https://github.com/nodejs/node/pull/2447 description: Documentation-only deprecation. -->

Type: End-of-Life

The util.isSymbol() API has been removed. Please use typeof arg === 'symbol' instead.

An automated migration is available (source):

npx codemod@latest @nodejs/util-is

DEP0058: util.isUndefined()

<!-- YAML changes: - version: v23.0.0 pr-url: https://github.com/nodejs/node/pull/52744 description: End-of-Life deprecation. - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: - v6.12.0 - v4.8.6 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: - v4.0.0 - v3.3.1 pr-url: https://github.com/nodejs/node/pull/2447 description: Documentation-only deprecation. -->

Type: End-of-Life

The util.isUndefined() API has been removed. Please use arg === undefined instead.

An automated migration is available (source):

npx codemod@latest @nodejs/util-is

DEP0059: util.log()

<!-- YAML changes: - version: v23.0.0 pr-url: https://github.com/nodejs/node/pull/52744 description: End-of-Life deprecation. - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: v6.12.0 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v6.0.0 pr-url: https://github.com/nodejs/node/pull/6161 description: Documentation-only deprecation. -->

Type: End-of-Life

The util.log() API has been removed because it's an unmaintained legacy API that was exposed to user land by accident. Instead, consider the following alternatives based on your specific needs:

  • Third-Party Logging Libraries

  • Use console.log(new Date().toLocaleString(), message)

By adopting one of these alternatives, you can transition away from util.log() and choose a logging strategy that aligns with the specific requirements and complexity of your application.

An automated migration is available (source):

npx codemod@latest @nodejs/util-log-to-console-log

DEP0060: util._extend()

<!-- YAML changes: - version: v22.0.0 pr-url: https://github.com/nodejs/node/pull/50488 description: Runtime deprecation. - version: v6.12.0 pr-url: https://github.com/nodejs/node/pull/10116 description: A deprecation code has been assigned. - version: v6.0.0 pr-url: https://github.com/nodejs/node/pull/4903 description: Documentation-only deprecation. -->

Type: Runtime

The [util._extend()][] API is deprecated because it's an unmaintained legacy API that was exposed to user land by accident. Please use target = Object.assign(target, source) instead.

An automated migration is available (source):

npx codemod@latest @nodejs/util-extend-to-object-assign

DEP0061: fs.SyncWriteStream

<!-- YAML changes: - version: v11.0.0 pr-url: https://github.com/nodejs/node/pull/20735 description: End-of-Life. - version: v8.0.0 pr-url: https://github.com/nodejs/node/pull/10467 description: Runtime deprecation. - version: v7.0.0 pr-url: https://github.com/nodejs/node/pull/6749 description: Documentation-only deprecation. -->

Type: End-of-Life

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

<!-- YAML changes: - version: v12.0.0 pr-url: https://gith

(本文超出站点单文档体积上限,已截断)