deno.com
在当前页面

Node API

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

探索内置的 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: 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
  • export

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 Jump to heading

node:events Jump to heading

node:fs Jump to heading

writeFile: Missing utf16le, latin1 and ucs2 encoding.

writeFileSync: Missing utf16le, latin1 and ucs2 encoding.

node:fs/promises Jump to heading

lchmod: The lchmod implementation is a not implemented.

node:module Jump to heading

Module: The register method is a non-functional stub.

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

This module has been added in 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

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 Jump to heading

Socket: The following methods are non-functional stubs:

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

node:dns Jump to heading

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 Jump to heading

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 Jump to heading

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 Jump to heading

Server: The cert and key options do not support an array input.

node:inspector Jump to heading

console is supported. Other APIs are non-functional stubs.

node:net Jump to heading

Socket: The fd option is not supported.

node:perf_hooks Jump to heading

performance: The eventLoopUtilization method is a non-functional stub. The timerify method is not implemented.

monitorEventLoopDelay: This symbol is not implemented.

node:process Jump to heading

The multipleResolves and worker events are not supported.

node:test Jump to heading

Currently only test API is supported.

node:tls Jump to heading

createSecurePair: This symbol is currently not supported.

node:util Jump to heading

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 Jump to heading

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 Jump to heading

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 Jump to heading

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 Jump to heading

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.

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

node:cluster Jump to heading

All exports are non-functional stubs.

All symbols: This symbol is a non-functional stub.

node:domain Jump to heading

All exports are non-functional stubs. This is a deprecated Node module.

All symbols: This symbol is a non-functional stub.

node:repl Jump to heading

All symbols are not supported.

All symbols: This symbol is not supported.

node:sea Jump to heading

All symbols are not supported.

All symbols: This symbol is not supported.

node:trace_events Jump to heading

All exports are non-functional stubs.

All symbols: This symbol is a non-functional stub.

node:wasi Jump to heading

All exports are non-functional stubs.

All symbols: This symbol is a non-functional stub.

全局对象 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

你找到需要的内容了吗?

隐私政策