Movatterモバイル変換


[0]ホーム

URL:


DocsGuidesBlog
Discord logoDiscord logo
Discord
GitHub logoGitHub logo

Intro

What is Bun?

Installation

Quickstart

TypeScript

Templating

bun init

bun create

Runtime

bun run

File types

TypeScript

JSX

Environment variables

Bun APIs

Web APIs

Node.js compatibility

Single-file executable

Plugins

Watch mode

Module resolution

Auto-install

bunfig.toml

Debugger

Framework APISOON

Package manager

bun install

bun add

bun remove

bun update

bun publish

bun outdated

bun link

bun pm

Global cache

Workspaces

Lifecycle scripts

Filter

Lockfile

Scopes and registries

Overrides and resolutions

Patch dependencies

.npmrc support

Bundler

Bun.build

HTML & static sites

CSS

Fullstack Dev Server

Hot reloading

Loaders

Plugins

Macros

vs esbuild

Test runner

bun test

Writing tests

Watch mode

Lifecycle hooks

Mocks

Snapshots

Dates and times

DOM testing

Code coverage

Package runner

bunx

API

HTTP server

HTTP client

WebSockets

Workers

Binary data

Streams

SQL

S3 Object Storage

File I/O

import.meta

SQLite

FileSystemRouter

TCP sockets

UDP sockets

Globals

$ Shell

Child processes

HTMLRewriter

Hashing

Console

Cookie

FFI

C Compiler

Testing

Utils

Node-API

Glob

DNS

Semver

Color

Transpiler

Project

Roadmap

Benchmarking

Contributing

Building Windows

Bindgen

License

Bun logoBunBun

Search the docs...

/

Intro

What is Bun?

Installation

Quickstart

TypeScript

Templating

bun init

bun create

Runtime

bun run

File types

TypeScript

JSX

Environment variables

Bun APIs

Web APIs

Node.js compatibility

Built-in Node.js modules
node:assert
node:buffer
node:console
node:dgram
node:diagnostics_channel
node:dns
node:events
node:fs
node:http
node:https
node:os
node:path
node:punycode
node:querystring
node:readline
node:stream
node:string_decoder
node:timers
node:tty
node:url
node:zlib
node:async_hooks
node:child_process
node:cluster
node:crypto
node:domain
node:http2
node:module
node:net
node:perf_hooks
node:process
node:sys
node:tls
node:util
node:v8
node:vm
node:wasi
node:worker_threads
node:inspector
node:repl
node:sqlite
node:test
node:trace_events
Node.js globals
AbortController
AbortSignal
Blob
Buffer
ByteLengthQueuingStrategy
__dirname
__filename
atob()
BroadcastChannel
btoa()
clearImmediate()
clearInterval()
clearTimeout()
CompressionStream
console
CountQueuingStrategy
Crypto
SubtleCrypto (crypto)
CryptoKey
CustomEvent
DecompressionStream
Event
EventTarget
exports
fetch
FormData
global
globalThis
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()
SubtleCrypto
DOMException
TextDecoder
TextDecoderStream
TextEncoder
TextEncoderStream
TransformStream
TransformStreamDefaultController
URL
URLSearchParams
WebAssembly
WritableStream
WritableStreamDefaultController
WritableStreamDefaultWriter

Single-file executable

Plugins

Watch mode

Module resolution

Auto-install

bunfig.toml

Debugger

Framework APISOON

Package manager

bun install

bun add

bun remove

bun update

bun publish

bun outdated

bun link

bun pm

Global cache

Workspaces

Lifecycle scripts

Filter

Lockfile

Scopes and registries

Overrides and resolutions

Patch dependencies

.npmrc support

Bundler

Bun.build

HTML & static sites

CSS

Fullstack Dev Server

Hot reloading

Loaders

Plugins

Macros

vs esbuild

Test runner

bun test

Writing tests

Watch mode

Lifecycle hooks

Mocks

Snapshots

Dates and times

DOM testing

Code coverage

Package runner

bunx

API

HTTP server

HTTP client

WebSockets

Workers

Binary data

Streams

SQL

S3 Object Storage

File I/O

import.meta

SQLite

FileSystemRouter

TCP sockets

UDP sockets

Globals

$ Shell

Child processes

HTMLRewriter

Hashing

Console

Cookie

FFI

C Compiler

Testing

Utils

Node-API

Glob

DNS

Semver

Color

Transpiler

Project

Roadmap

Benchmarking

Contributing

Building Windows

Bindgen

License

Node.js compatibility

GitHub logoGitHub logo

Edit on GitHub

Every day, Bun gets closer to 100% Node.js API compatibility. Today, popular frameworks like Next.js, Express, and millions ofnpm packages intended for Node just work with Bun. To ensure compatibility, we run thousands of tests from Node.js' test suite before every release of Bun.

If a package works in Node.js but doesn't work in Bun, we consider it a bug in Bun. Pleaseopen an issue and we'll fix it.

This page is updated regularly to reflect compatibility status of the latest version of Bun. The information below reflects Bun's compatibility withNode.js v23.

Built-in Node.js modules

node:assert

🟢 Fully implemented.

node:buffer

🟢 Fully implemented.

node:console

🟢 Fully implemented.

node:dgram

🟢 Fully implemented. > 90% of Node.js's test suite passes.

node:diagnostics_channel

🟢 Fully implemented.

node:dns

🟢 Fully implemented. > 90% of Node.js's test suite passes.

node:events

🟢 Fully implemented.EventEmitterAsyncResource usesAsyncResource underneath. 100% of Node.js's test suite for EventEmitter passes.

node:fs

🟢 Fully implemented. 92% of Node.js's test suite passes.

node:http

🟢 Fully implemented. Outgoing client request body is currently buffered instead of streamed.

node:https

🟢 APIs are implemented, butAgent is not always used yet.

node:os

🟢 Fully implemented. 100% of Node.js's test suite passes.

node:path

🟢 Fully implemented. 100% of Node.js's test suite passes.

node:punycode

🟢 Fully implemented. 100% of Node.js's test suite passes,deprecated by Node.js.

node:querystring

🟢 Fully implemented. 100% of Node.js's test suite passes.

node:readline

🟢 Fully implemented.

node:stream

🟢 Fully implemented.

node:string_decoder

🟢 Fully implemented. 100% of Node.js's test suite passes.

node:timers

🟢 Recommended to use globalsetTimeout, et. al. instead.

node:tty

🟢 Fully implemented.

node:url

🟢 Fully implemented.

node:zlib

🟢 Fully implemented. 98% of Node.js's test suite passes.

node:async_hooks

🟡AsyncLocalStorage, andAsyncResource are implemented. v8 promise hooks are not called, and its usage isstrongly discouraged.

node:child_process

🟡 Missingproc.gidproc.uid.Stream class not exported. IPC cannot send socket handles. Node.js <> Bun IPC can be used with JSON serialization.

node:cluster

🟡 Handles and file descriptors cannot be passed between workers, which means load-balancing HTTP requests across processes is only supported on Linux at this time (viaSO_REUSEPORT). Otherwise, implemented but not battle-tested.

node:crypto

🟡 MissingsecureHeapUsedsetEnginesetFips

Some methods are not optimized yet.

node:domain

🟡 MissingDomainactive

node:http2

🟡 Client & server are implemented (95.25% of gRPC's test suite passes). Missingoptions.allowHTTP1,options.enableConnectProtocol, ALTSVC extension, andhttp2stream.pushStream.

node:module

🟡 MissingsyncBuiltinESMExports,Module#load(). Overridingrequire.cache is supported for ESM & CJS modules.module._extensions,module._pathCache,module._cache are no-ops.module.register is not implemented and we recommend using aBun.plugin in the meantime.

node:net

🟡SocketAddress class not exposed (but implemented).BlockList exists but is a no-op.

node:perf_hooks

🟡 MissingcreateHistogrammonitorEventLoopDelay. It's recommended to useperformance global instead ofperf_hooks.performance.

node:process

🟡 Seeprocess Global.

node:sys

🟡 Seenode:util.

node:tls

🟡 Missingtls.createSecurePair.

node:util

🟡 MissinggetCallSitegetCallSitesgetSystemErrorMapgetSystemErrorMessagetransferableAbortSignaltransferableAbortControllerMIMETypeMIMEParams

node:v8

🟡writeHeapSnapshot andgetHeapSnapshot are implemented.serialize anddeserialize use JavaScriptCore's wire format instead of V8's. Other methods are not implemented. For profiling, usebun:jsc instead.

node:vm

🟡 Core functionality works, but experimental VM ES modules are not implemented, includingvm.Module,vm.SourceTextModule,vm.SyntheticModule,importModuleDynamically, andvm.measureMemory. Options liketimeout,breakOnSigint,cachedData are not implemented yet.

node:wasi

🟡 Partially implemented.

node:worker_threads

🟡Worker doesn't support the following options:stdinstdoutstderrtrackedUnmanagedFdsresourceLimits. MissingmarkAsUntransferablemoveMessagePortToContextgetHeapSnapshot.

node:inspector

🔴 Not implemented.

node:repl

🔴 Not implemented.

node:sqlite

🔴 Not implemented.

node:test

🟡 Partly implemented. Missing mocks, snapshots, timers. Usebun:test instead.

node:trace_events

🔴 Not implemented.

Node.js globals

The table below lists all globals implemented by Node.js and Bun's current compatibility status.

AbortController

🟢 Fully implemented.

AbortSignal

🟢 Fully implemented.

Blob

🟢 Fully implemented.

Buffer

🟢 Fully implemented.

ByteLengthQueuingStrategy

🟢 Fully implemented.

__dirname

🟢 Fully implemented.

__filename

🟢 Fully implemented.

atob()

🟢 Fully implemented.

BroadcastChannel

🟢 Fully implemented.

btoa()

🟢 Fully implemented.

clearImmediate()

🟢 Fully implemented.

clearInterval()

🟢 Fully implemented.

clearTimeout()

🟢 Fully implemented.

CompressionStream

🔴 Not implemented.

console

🟢 Fully implemented.

CountQueuingStrategy

🟢 Fully implemented.

Crypto

🟢 Fully implemented.

SubtleCrypto (crypto)

🟢 Fully implemented.

CryptoKey

🟢 Fully implemented.

CustomEvent

🟢 Fully implemented.

DecompressionStream

🔴 Not implemented.

Event

🟢 Fully implemented.

EventTarget

🟢 Fully implemented.

exports

🟢 Fully implemented.

fetch

🟢 Fully implemented.

FormData

🟢 Fully implemented.

global

🟢 Implemented. This is an object containing all objects in the global namespace. It's rarely referenced directly, as its contents are available without an additional prefix, e.g.__dirname instead ofglobal.__dirname.

globalThis

🟢 Aliases toglobal.

Headers

🟢 Fully implemented.

MessageChannel

🟢 Fully implemented.

MessageEvent

🟢 Fully implemented.

MessagePort

🟢 Fully implemented.

module

🟢 Fully implemented.

PerformanceEntry

🟢 Fully implemented.

PerformanceMark

🟢 Fully implemented.

PerformanceMeasure

🟢 Fully implemented.

PerformanceObserver

🟢 Fully implemented.

PerformanceObserverEntryList

🟢 Fully implemented.

PerformanceResourceTiming

🟢 Fully implemented.

performance

🟢 Fully implemented.

process

🟡 Mostly implemented.process.binding (internal Node.js bindings some packages rely on) is partially implemented.process.title is currently a no-op on macOS & Linux.getActiveResourcesInfosetActiveResourcesInfo,getActiveResources andsetSourceMapsEnabled are stubs. Newer APIs likeprocess.loadEnvFile andprocess.getBuiltinModule are not implemented yet.

queueMicrotask()

🟢 Fully implemented.

ReadableByteStreamController

🟢 Fully implemented.

ReadableStream

🟢 Fully implemented.

ReadableStreamBYOBReader

🟢 Fully implemented.

ReadableStreamBYOBRequest

🟢 Fully implemented.

ReadableStreamDefaultController

🟢 Fully implemented.

ReadableStreamDefaultReader

🟢 Fully implemented.

require()

🟢 Fully implemented, includingrequire.main,require.cache,require.resolve.

Response

🟢 Fully implemented.

Request

🟢 Fully implemented.

setImmediate()

🟢 Fully implemented.

setInterval()

🟢 Fully implemented.

setTimeout()

🟢 Fully implemented.

structuredClone()

🟢 Fully implemented.

SubtleCrypto

🟢 Fully implemented.

DOMException

🟢 Fully implemented.

TextDecoder

🟢 Fully implemented.

TextDecoderStream

🟢 Fully implemented.

TextEncoder

🟢 Fully implemented.

TextEncoderStream

🟢 Fully implemented.

TransformStream

🟢 Fully implemented.

TransformStreamDefaultController

🟢 Fully implemented.

URL

🟢 Fully implemented.

URLSearchParams

🟢 Fully implemented.

WebAssembly

🟢 Fully implemented.

WritableStream

🟢 Fully implemented.

WritableStreamDefaultController

🟢 Fully implemented.

WritableStreamDefaultWriter

🟢 Fully implemented.

Previous

Web APIs

Next

Single-file executable

GitHub logoGitHub logo

Edit on GitHub


[8]ページ先頭

©2009-2025 Movatter.jp