deno.com
本页内容

Node API

Deno 为许多内置的 Node.js 模块和全局对象提供了 polyfill。

探索内置的 Node API

Node 兼容性是一个持续进行中的项目——请通过在 GitHub 上提出问题来帮助我们找出不足,并告诉我们您需要哪些模块。

完全支持的模块 (21/44) Jump to heading

node:assert Jump to heading

node:buffer Jump to heading

node:child_process Jump to heading

node:console Jump to heading

node:crypto Jump to heading

Certificate:这些方法是无功能存根。

generateKeyPair:不支持 x448 选项。

generatePrime:不支持 safeaddrem 选项。

KeyObject:以下是无功能存根

  • from
  • symmetricKeySize
  • equals
  • export

publicDecrypt:此符号是无功能存根。

secureHeapUsed:此符号是无功能存根。

setEngine:此符号是无功能存根。

ECDHconvertKey 方法是一个无功能存根。

Sign:不支持非 BinaryLike 输入的 signverify 方法。

node:diagnostics_channel Jump to heading

node:events Jump to heading

node:fs Jump to heading

writeFile:缺少 utf16lelatin1ucs2 编码。

writeFileSync:缺少 utf16lelatin1ucs2 编码。

node:fs/promises Jump to heading

lchmodlchmod 实现未实现。

node:module Jump to heading

Moduleregister 方法是无功能存根。

node:os Jump to heading

node:path Jump to heading

node:punycode Jump to heading

node:querystring Jump to heading

node:readline Jump to heading

node:sqlite Jump to heading

此模块已在 Deno v2.2 中添加。

node:stream Jump to heading

node:string_decoder Jump to heading

node:timers Jump to heading

node:tty Jump to heading

node:url Jump to heading

部分支持的模块 (17/44) Jump to heading

node:async_hooks Jump to heading

AsyncResourceAsyncResource 实现是无功能存根。

executionAsyncIdexecutionAsyncId 实现是无功能存根。

createHookcreateHook 实现是无功能存根。

node:dgram Jump to heading

Socket:以下方法是无功能存根

  • addMembership
  • addSourceSpecificMembership
  • dropMembership
  • dropSourceSpecificMembership
  • setBroadcast
  • setMulticastInterface
  • setMulticastLoopback
  • setMulticastTtl
  • setTtl

node:dns Jump to heading

resolve:不支持 ttl 选项。

resolve4:不支持 ttl 选项。

resolve6:不支持 ttl 选项。

resolveCname:不支持 ttl 选项。

resolveCaa:不支持 ttl 选项。

resolveMx:不支持 ttl 选项。

resolveNaptr:不支持 ttl 选项。

resolveNs:不支持 ttl 选项。

resolvePtr:不支持 ttl 选项。

resolveSoa:不支持 ttl 选项。

resolveSrv:不支持 ttl 选项。

resolveTxt:不支持 ttl 选项。

resolveAny:不支持 ttl 选项。

node:http Jump to heading

RequestOptions:不支持 createConnection 选项。

ClientRequestArgs:不支持 createConnection 选项。

ClientRequest:不支持构造函数选项 createConnection

request:不支持构造函数选项 createConnection

get:不支持构造函数选项 createConnection

node:http2 Jump to heading

Http2Session:以下方法是无功能存根

  • setLocalWindowSize
  • ping
  • localSettings
  • remoteSettings
  • settings
  • ref
  • unref

ServerHttp2Session:所有方法都是无功能存根。

Http2Stream:以下方法是无功能存根

  • aborted
  • bufferSize
  • endAfterHeaders
  • id
  • pending
  • priority
  • rstCode
  • sentHeaders
  • sentInfoHeaders
  • sentTrailers
  • state

ClientHttp2Stream:所有方法都是无功能存根。

getDefaultSettings:此函数是无功能存根。

getPackedSettings:此函数是无功能存根。

getUnpackedSettings:此函数是无功能存根。

node:https Jump to heading

Servercertkey 选项不支持数组输入。

node:inspector Jump to heading

console 受支持。其他 API 都是无功能存根。

node:net Jump to heading

Socket:不支持 fd 选项。

node:perf_hooks Jump to heading

performanceeventLoopUtilization 方法是无功能存根。timerify 方法未实现。

monitorEventLoopDelay:此符号未实现。

node:process Jump to heading

不支持 multipleResolvesworker 事件。

node:test Jump to heading

目前仅支持 test API。

node:tls Jump to heading

createSecurePair:此符号目前不受支持。

node:util Jump to heading

transferableAbortSignal:此符号目前不受支持。

transferableAbortController:此符号目前不受支持。

MIMEParams:此符号目前不受支持。

MIMEType:此符号目前不受支持。

getSystemErrorMap:此符号目前不受支持。

node:v8 Jump to heading

cachedDataVersionTaggetHeapStatisticsserialize 以及 deserialize 受支持。setFlagsFromStrings 是一个空操作 (noop)。其他 API 不受支持,并将抛出错误。

setFlagsFromStrings:此函数是一个空操作 (noop)。

node:vm Jump to heading

measureMemory:这是一个无功能存根。

compile:不支持 importModuleDynamically 参数。

createContext:不支持 importModuleDynamically 参数。

Script:不支持 importModuleDynamically 参数。runInContext 方法不支持在 SIGINT 上中断。

node:worker_threads Jump to heading

parentPort:不支持 emit 方法。不支持 removeAllListeners 方法。

markAsUntransferable:此符号不受支持。

moveMessagePortToContext:此符号不受支持。

receiveMessageOnPort:此符号不受支持。

Worker:不支持 getHeapSnapshot 方法。

node:zlib Jump to heading

Options:此类不受支持。

BrotliOptions:此类不受支持。

BrotliCompress:此类不受支持。

BrotliDecompress:此类不受支持。

ZlibBase:此类不受支持。

不支持的模块 (6/44) Jump to heading

node:cluster Jump to heading

所有导出都是无功能存根。

所有符号:此符号是无功能存根。

node:domain Jump to heading

所有导出都是无功能存根。这是一个已弃用的 Node 模块。

所有符号:此符号是无功能存根。

node:repl Jump to heading

所有符号都不受支持。

所有符号:此符号不受支持。

node:sea Jump to heading

所有符号都不受支持。

所有符号:此符号不受支持。

node:trace_events Jump to heading

所有导出都是无功能存根。

所有符号:此符号是无功能存根。

node:wasi Jump to heading

所有导出都是无功能存根。

所有符号:此符号是无功能存根。

全局对象 Jump to heading

这是 Deno 支持的 Node 全局对象列表。这些全局对象仅在 npm 包范围内可用。在您自己的代码中,可以通过从相关的 node: 模块导入它们来使用。

全局名称 状态
AbortController
AbortSignal
Blob
Buffer
ByteLengthQueuingStrategy
__dirname ⚠️ 信息
__filename ⚠️ 信息
atob
BroadcastChannel
btoa
clearImmediate
clearInterval
clearTimeout
CompressionStream
console
CountQueuingStrategy
Crypto
CryptoKey
CustomEvent
CustomEvent
DecompressionStream
Event
EventTarget
exports
fetch
File
FormData
global
Headers
MessageChannel
MessageEvent
MessagePort
module
PerformanceEntry
PerformanceMark
PerformanceMeasure
PerformanceObserver
PerformanceObserverEntryList
PerformanceResourceTiming
performance
process
queueMicrotask
ReadableByteStreamController
ReadableStream
ReadableStreamBYOBReader
ReadableStreamBYOBRequest
ReadableStreamDefaultController
ReadableStreamDefaultReader
require
Response
Request
setImmediate
setInterval
setTimeout
structuredClone
structuredClone
SubtleCrypto
DOMException
TextDecoder
TextDecoderStream
TextEncoder
TextEncoderStream
TransformStream
TransformStreamDefaultController
URL
URLSearchParams
URLSearchParams
WebAssembly
WritableStream
WritableStreamDefaultController
WritableStreamDefaultWriter

Node 测试结果 Jump to heading

如果您对每个测试用例的兼容性有更详细的了解,您可以在此页面上找到通过和失败的 Node.js 测试用例列表。

您找到所需内容了吗?

隐私政策