Node API 兼容性列表
Deno 为许多内置的 Node.js 模块和全局变量提供了 polyfill。Node 兼容性是一个持续进行的项目 - 帮助我们识别差距,并通过 在 GitHub 上打开问题 让我们知道您需要哪些模块。
内置模块支持 跳转到标题
node:async_hooks
ℹ️
AsyncLocalStorage
is supported. AsyncResource
,{" "}
executionAsyncId
, and createHook
are
non-functional stubs.
node:child_process
ℹ️
The ipc
and overlapped
stdio options are missing.
Passing file descriptors by an integer value is missing.
node:crypto
ℹ️
Missing Certificate
class,{" "}
crypto.Cipheriv.prototype.setAutoPadding
,{" "}
crypto.Decipheriv.prototype.setAutoPadding
,{" "}
crypto.getCipherInfo
, crypto.publicDecrypt
,{" "}
crypto.ECDH.prototype.convertKey
,{" "}
crypto.diffieHellman
, x448
option for{" "}
generateKeyPair
, crypto.KeyObject
,{" "}
safe
, add
and rem
options for{" "}
generatePrime
, crypto.Sign.prototype.sign
and{" "}
crypto.Verify.prototype.verify
with non BinaryLike
{" "}
input, crypto.secureHeapUsed
, crypto.setEngine
,
legacy methods of crypto.X509Certificate
.
node:dgram
ℹ️
Some dgram.Socket
instance methods are non-functional stubs:
addMembership
addSourceSpecificMembership
dropMembership
dropSourceSpecificMembership
setBroadcast
setMulticastInterface
setMulticastLoopback
setMulticastTtl
setTtl
ref
unref
node:fs
ℹ️
node:fs
Missing utf16le
, latin1
and ucs2
{" "}
encoding for fs.writeFile
and fs.writeFileSync
.
Missing Dirent.isBlockDevice
,{" "}
Dirent.isCharacterDevice
, Dirent.isFIFO
,{" "}
Dirent.isSocket
, FSWatcher.ref
,{" "}
FSWatcher.unref
.
node:fs/promises
Missing lchmod
, lchown
, lutimes
.
node:https
ℹ️
Missing https.Server.opts.cert
and{" "}
https.Server.opts.key
array type.
node:inspector
ℹ️
console
is supported. Other APIs are stubs and will throw an
error. Due to security implications the Deno team does not plan to polyfill
these APIs.
node:perf_hooks
ℹ️
Missing perf_hooks.eventLoopUtilization
,{" "}
perf_hooks.timerify
,{" "}
perf_hooks.monitorEventLoopDelay
.
node:repl
ℹ️
builtinModules
and _builtinLibs
are supported.
Missing REPLServer.prototype.constructor
and{" "}
start()
.
node:string_decoder
ℹ️
Missing decoding of ascii
, latin1
and{" "}
utf16le
decoding options.
node:util
ℹ️
Missing aborted
, transferableAbortSignal
, transferableAbortController
, MIMEParams
, MIMEType
, getSystemErrorMap
, and debug
.
node:v8
ℹ️
cachedDataVersionTag
and getHeapStatistics
are
supported. setFlagsFromStrings
is a noop. Other APIs are not
supported and will throw and error. The other APIs could be
polyfilled, but due inherent lack of format stability between the V8
versions, the Deno team is considering requiring a special flag to use them.
node:vm
ℹ️
runInThisContext
is supported. Other APIs are not polyfilled
and will throw and error.
node:worker_threads
ℹ️
Missing parentPort.emit
,{" "}
parentPort.removeAllListeners
,{" "}
markAsUntransferable
, moveMessagePortToContext
,{" "}
receiveMessageOnPort
,{" "}
Worker.prototype.getHeapSnapshot
.
node:zlib
ℹ️
Missing Options.prototype.constructor
,{" "}
BrotliOptions.prototype.constructor
,{" "}
BrotliDecompress.prototype.constructor
,{" "}
ZlibBase.prototype.constructor
.
全局变量 跳转到标题
这是 Deno 支持的 Node 全局变量列表。这些全局变量仅在 npm
包作用域中可用。在您自己的代码中,您可以通过从相关的 node:
模块导入它们来使用它们。