Node APIs
Deno provides polyfills for a number of built-in Node.js modules and globals.
Node compatibility is an ongoing project - help us identify gaps and let us know which modules you need by opening an issue on GitHub.
Fully supported modules (22/44)
node:assert
node:buffer
node:child_process
node:console
node:crypto
Certificate: The methods are non-functional stubs.
generateKeyPair: The x448 option is not supported.
generatePrime: The safe, add and rem option is not supported.
KeyObject: The following are non-functional stubs:
- from
- symmetricKeySize
- equals
publicDecrypt: This symbol is a non-functional stub.
secureHeapUsed: This symbol is a non-functional stub.
setEngine: This symbol is a non-functional stub.
ECDH: The convertKey method is a non-functional sub.
Sign: The sign and verify methods are not supported with non BinaryLike input.
node:diagnostics_channel
node:events
node:fs
writeFile: Missing utf16le, latin1 and ucs2 encoding.
writeFileSync: Missing utf16le, latin1 and ucs2 encoding.
node:fs/promises
lchmod: The lchmod implementation is a not implemented.
node:module
Module: The register method is a non-functional stub.
node:os
node:path
node:punycode
node:querystring
node:readline
node:sqlite
This module has been added in Deno v2.2.
node:stream
node:string_decoder
node:test
node:timers
node:tty
node:url
Partially supported modules (16/44)
node:async_hooks
AsyncResource: The AsyncResource implementation is a non-functional stub.
executionAsyncId: The executionAsyncId implementation is a non-functional stub.
createHook: The createHook implementation is a non-functional stub.
node:dgram
Socket: The following methods are non-functional stubs:
- addMembership
- addSourceSpecificMembership
- dropMembership
- dropSourceSpecificMembership
- setBroadcast
- setMulticastInterface
- setMulticastLoopback
- setMulticastTtl
- setTtl
node:dns
resolve: The ttl option is not supported.
resolve4: The ttl option is not supported.
resolve6: The ttl option is not supported.
resolveCname: The ttl option is not supported.
resolveCaa: The ttl option is not supported.
resolveMx: The ttl option is not supported.
resolveNaptr: The ttl option is not supported.
resolveNs: The ttl option is not supported.
resolvePtr: The ttl option is not supported.
resolveSoa: The ttl option is not supported.
resolveSrv: The ttl option is not supported.
resolveTxt: The ttl option is not supported.
resolveAny: The ttl option is not supported.
node:http
RequestOptions: Option createConnection is not supported.
ClientRequestArgs: Option createConnection is not supported.
ClientRequest: Constructor option createConnection is not supported.
request: Constructor option createConnection is not supported.
get: Constructor option createConnection is not supported.
node:http2
Http2Session: The following methods are non-functional stubs:
- setLocalWindowSize
- ping
- localSettings
- remoteSettings
- settings
- ref
- unref
ServerHttp2Session: All methods are non-functional stubs.
Http2Stream: The following methods are non-functional stubs:
- aborted
- bufferSize
- endAfterHeaders
- id
- pending
- priority
- rstCode
- sentHeaders
- sentInfoHeaders
- sentTrailers
- state
ClientHttp2Stream: All methods are non-functional stubs.
getDefaultSettings: This function is a non-functional stub.
getPackedSettings: This function is a non-functional stub.
getUnpackedSettings: This function is a non-functional stub.
node:https
Server: The cert and key options do not support an array input.
node:inspector
console is supported. Other APIs are non-functional stubs.
node:net
Socket: The fd option is not supported.
node:perf_hooks
performance: The eventLoopUtilization method is a non-functional stub. The timerify method is not implemented.
monitorEventLoopDelay: This symbol is not implemented.
node:process
The multipleResolves and worker events are not supported.
node:tls
createSecurePair: This symbol is currently not supported.
node:util
transferableAbortSignal: This symbol is currently not supported.
transferableAbortController: This symbol is currently not supported.
MIMEParams: This symbol is currently not supported.
MIMEType: This symbol is currently not supported.
getSystemErrorMap: This symbol is currently not supported.
node:v8
cachedDataVersionTag and getHeapStatistics, serialize and deserialize are supported. setFlagsFromStrings is a noop. Other APIs are not supported and will throw and error.
setFlagsFromStrings: This function is a noop.
node:vm
measureMemory: This is a non-functional stub.
compile: The importModuleDynamically parameter is not supported.
createContext: The importModuleDynamically parameter is not supported.
Script: The importModuleDynamically parameter is not supported. The runInContext method does not support break on SIGINT.
node:worker_threads
parentPort: The emit method is not supported. The removeAllListeners method is not supported.
markAsUntransferable: This symbol is not supported.
moveMessagePortToContext: This symbol is not supported.
receiveMessageOnPort: This symbol is not supported.
Worker: The getHeapSnapshot method is not supported.
node:zlib
Options: This class is not supported.
BrotliOptions: This class is not supported.
BrotliCompress: This class is not supported.
BrotliDecompress: This class is not supported.
ZlibBase: This class is not supported.
Unsupported modules (6/44)
node:cluster
All exports are non-functional stubs.
All symbols: This symbol is a non-functional stub.
node:domain
All exports are non-functional stubs. This is a deprecated Node module.
All symbols: This symbol is a non-functional stub.
node:repl
All symbols are not supported.
All symbols: This symbol is not supported.
node:sea
All symbols are not supported.
All symbols: This symbol is not supported.
node:trace_events
All exports are non-functional stubs.
All symbols: This symbol is a non-functional stub.
node:wasi
All exports are non-functional stubs.
All symbols: This symbol is a non-functional stub.
Globals
This is the list of Node globals that Deno supports. These globals are only available in the npm package scope. In your own code you can use them by importing them from the relevant node: module.
__dirname and __filename
__dirname and __filename are CommonJS globals. They are available inside CommonJS modules in the npm package scope, but they are not defined in ES modules. In your own ES modules use import.meta.dirname and import.meta.filename instead, which provide the same values for the current module.
Module notes
node:worker_threads
Deno 2.7 significantly improved node:worker_threads compatibility:
-
stdoutandstderrstreams are forwarded correctly from workers to the parent process. -
worker.terminate()now resolves with the correct exit code. -
workerData,execArgv, andthreadNameoptions are supported. -
worker.performance.eventLoopUtilization()andworker.cpuUsage()are implemented. -
BroadcastChannelfrom worker threads is properly ref'd/unref'd.
node:child_process
Deno 2.7 improved node:child_process compatibility:
-
stdiostreams (stdin,stdout,stderr) are exposed asSocketinstances, matching Node.js behavior. - Shell redirection (
>,<,>>) works inexec()andexecSync(). -
fork()accepts aURLas the module path. -
timeoutandkillSignaloptions are supported inexec()andspawn(). -
NODE_OPTIONSenvironment variable is respected forfork()'d processes.
node:zlib
Deno 2.7 added Zstd compression support to node:zlib:
import zlib from "node:zlib";
import { promisify } from "node:util";
const compress = promisify(zlib.zstdCompress);
const decompress = promisify(zlib.zstdDecompress);
const compressed = await compress(Buffer.from("Hello, Deno!"));
const result = await decompress(compressed);
console.log(result.toString()); // "Hello, Deno!"
The synchronous variants zlib.zstdCompressSync() and zlib.zstdDecompressSync() are also available.
node:sqlite
Deno 2.7 added several new APIs to node:sqlite:
-
DatabaseSync.setAuthorizer(callback)— registers a callback invoked for every SQL operation, enabling fine-grained access control over which tables and operations are permitted:
import { constants, DatabaseSync } from "node:sqlite";
const db = new DatabaseSync(":memory:");
db.exec("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)");
// Allow reads, deny everything else
db.setAuthorizer((_action, _table) => {
return constants.SQLITE_OK;
});
-
DatabaseSync.enableDefensive(enabled)— enables or disables defensive mode, which prevents potentially dangerous database operations such as schema modifications at runtime. -
DatabaseSync.createTagStore()— creates a prepared-statement cache that maps SQL strings to compiled statements for efficient repeated execution.
Node test results
If you're interested in a more detailed view of compatibility on a per-test-case basis, you can find a list of both passing and failing Node.js test cases on this page.
Last updated on
© 2018–2025 the Deno authors
Licensed under the MIT License.
https://docs.deno.com/runtime/reference/node_apis