Buno.js is a cross-platform runtime adapter for JavaScript and TypeScript, designed to unify API access across Node.js, Bun, and Deno environments. It allows developers to write portable code with consistent APIs, optimizing performance and compatibility for each runtime.
- Cross-Platform Compatibility: Works seamlessly across Node.js, Bun, and Deno.
- Unified API: Provides a consistent interface for accessing common modules
like
fs
,path
, etc. - Runtime Detection: Automatically detects the runtime environment and loads the appropriate implementation.
- Optimized Performance: Adapts to each runtime's specific features for optimal performance.
Buno only supports at least one of the following runtimes:
You can install Buno
from NPM
or JSR
:
-
Using
npm
:From
NPM
:npm install buno.js
From
JSR
:npx jsr add @siguici/buno
-
Using
Yarn
:From
NPM
:yarn add buno.js
From
JSR
:yarn dlx jsr add @siguici/buno
-
Using
PNPM
:From
NPM
:pnpm add buno.js
From
JSR
:pnpm dlx jsr add @siguici/buno
-
Using
Bun
:From
NPM
:bun install buno.js
From
JSR
:bunx jsr add @siguici/buno
-
Using
Deno
:From
NPM
:deno install npm:buno.js
From
JSR
:deno add @siguici/buno
Without install:
import buno.js from 'jsr:@siguici/buno';
-
Import from
NPM
:import { fs, path } from 'buno.js';
-
Import from
JSR
:import { fs, path } from '@siguici/buno';
-
Import without install (using
Deno
):import { fs, path } from 'jsr:@siguici/buno';
-
Use modules imported from
Buno
:// Example usage of fs fs.readFile('example.txt', 'utf8', (err, data) => { if (err) throw err; console.log(data); }); // Example usage of path const fullPath = path.resolve('example.txt'); console.log(fullPath);
Buno aims to unify and simplify cross-runtime development
by providing a consistent interface for Node.js APIs
across Deno and Bun.
While Buno strives for complete Node.js API compatibility,
some modules may have partial or no implementation in specific runtimes.
Most npm packages intended for Node.js
environments
will work seamlessly with Buno, but the best way to ensure compatibility is
to test them directly.
This document is regularly updated to reflect the compatibility status
of the latest versions of Deno
and Bun
.
The information below reflects Buno's compatibility with Node.js v20 APIs
as implemented in both Deno
and Bun
. If you encounter any compatibility issues,
please open an issue on GitHub.
Reporting such issues helps us prioritize and address gaps in compatibility.
-
✅ = Implemented in both
-
⚠️ = Partial support -
❌ = Not implemented in either
-
🟢 = Fully implemented
-
🟡 = Partially implemented
-
🔴 = Not implemented
-
✅ node:assert
- 🟢 Fully implemented in both.
-
⚠️ node:async_hooks- 🟡 Only
AsyncLocalStorage
, andAsyncResource
are implemented.AsyncResource
is missing bind in Bun. - 🟡
AsyncLocalStorage
is supported.AsyncResource
,executionAsyncId
, andcreateHook
are non-functional stubs in Deno.
- 🟡 Only
-
✅ node:buffer
- 🟢 Fully implemented in both.
-
⚠️ node:child_process- 🟡 Missing
proc.gid
,proc.uid
. Stream class not exported. IPC cannot send socket handles in Bun. - 🟢 Fully implemented in Deno
- 🟡 Missing
-
❌ node:cluster
- 🔴 Not implemented in both.
-
✅ node:console
- 🟢 Fully implemented in both.
-
⚠️ node:crypto- 🟡 Missing various methods including
Certificate
,ECDH
,X509Certificate
, etc. Some methods are not optimized in Bun. - 🟡 Missing
Certificate class
,crypto.Cipheriv.prototype.setAutoPadding
,crypto.Decipheriv.prototype.setAutoPadding
,crypto.publicDecrypt
,crypto.ECDH.prototype.convertKey
,x448
option forgenerateKeyPair
,crypto.KeyObject
, and other methods in Deno.
- 🟡 Missing various methods including
-
⚠️ node:dgram- 🟡 Missing several methods such as
setBroadcast
,setTTL
,setMulticastTTL
, etc., in Bun. - 🟡 Some methods are non-functional stubs in Deno.
- 🟡 Missing several methods such as
-
✅ node:diagnostics_channel
- 🟢 Fully implemented in both.
-
⚠️ node:dns- 🟡 Missing
cancel
,setServers
,getDefaultResultOrder
in Bun. - 🟡 Missing
dns.resolve*
withttl
option in Deno.
- 🟡 Missing
-
⚠️ node:domain- 🔴 All exports are non-functional stubs in both
-
⚠️ node:events- 🟡
events.addAbortListener
&events.getMaxListeners
do not support (web api)EventTarget
in Bun. - 🟢 Fully implemented in Deno
- 🟡
-
⚠️ node:fs- 🟡 Missing
statfs
,statfsSync
,opendirSync
. Dir is partially implemented in Bun. - 🟡 Missing
utf16le
,latin1
, anducs2
encoding forfs.writeFile
andfs.writeFileSync
.lchmod
is missing infs/promises
in Deno.
- 🟡 Missing
-
✅ node:http
- 🟢 Fully implemented in both. Outgoing client request body is currently buffered instead of streamed in Bun.
-
⚠️ node:http2- 🟡 Client is supported, but server isn't yet in Bun.
- 🟡 Partially supported, major work in progress to enable
grpc-js
in Deno.
-
⚠️ node:https- 🟡 APIs are implemented, but Agent is not always used yet in Bun.
- 🟡
Missing https.Server.opts.cert
andhttps.Server.opts.key
array type in Deno.
-
❌ node:inspector
- 🔴 Not implemented in both.
-
⚠️ node:module- 🟡 Missing
runMain
,syncBuiltinESMExports
,Module#load()
. Attempts to override or patch the module cache will fail in Bun. - 🟡 The
register()
function is not supported in Deno.
- 🟡 Missing
-
⚠️ node:net- 🟡 Missing
SocketAddress
Stream
,BlockList
is a no-op in Bun. - 🟡 Missing
net.Socket.prototype.constructor
withfd
option in Deno.
- 🟡 Missing
-
✅ node:os
- 🟢 Fully implemented in both.
-
✅ node:path
- 🟢 Fully implemented in both.
-
⚠️ node:perf_hooks- 🟡 Missing
createHistogram
,monitorEventLoopDelay
in Bun. - 🟡 Missing
perf_hooks.eventLoopUtilization
,perf_hooks.timerify
,perf_hooks.monitorEventLoopDelay
in Deno.
- 🟡 Missing
-
⚠️ node:process- 🟡 See
process
Global in Bun. - 🟡 Missing
multipleResolves
,worker
events in Deno.
- 🟡 See
-
✅ node:punycode
- 🟢 Fully implemented in both.
-
✅ node:querystring
- 🟢 Fully implemented in both.
-
✅ node:readline
- 🟢 Fully implemented in both.
-
❌ node:repl
- 🔴 Not implemented in Bun.
- 🟡
builtinModules
and_builtinLibs
are supported. MissingREPLServer.prototype.constructor
andstart()
in Deno.
-
⚠️ node:stream- 🟡 Missing
getDefaultHighWaterMark
,setDefaultHighWaterMark
,toWeb
in Bun. - 🟢 Fully implemented in Deno.
- 🟡 Missing
-
✅ node:string_decoder
- 🟢 Fully implemented in both.
-
✅ node:sys
- 🟢 Fully implemented in both.
-
❌ node:test
- 🔴 Not implemented in Bun. Use
bun:test
instead. - 🟡 Currently only test API is supported in Deno.
- 🔴 Not implemented in Bun. Use
-
✅ node:timers
- 🟢 Fully implemented in both.
-
⚠️ node:tls- 🟡 Missing
createSecurePair
in both.
- 🟡 Missing
-
❌ node:trace_events
- 🔴 Not implemented in both.
-
✅ node:tty
- 🟢 Fully implemented in both.
-
⚠️ node:util- 🟡 Missing
MIMEParams
,MIMEType
,aborted
,debug
,getSystemErrorMap
,transferableAbortController
,transferableAbortSignal
in Bun. - 🟡 Missing
aborted
,transferableAbortSignal
,transferableAbortController
,MIMEParams
,MIMEType
andgetSystemErrorMap
in Deno.
- 🟡 Missing
-
✅ node:url
- 🟢 Fully implemented in both.
-
❌ node:v8
- 🟡
serialize
anddeserialize
use JavaScriptCore's wire format instead of V8's. Otherwise, not implemented in Bun. - 🟡
cachedDataVersionTag
andgetHeapStatistics
are supported.setFlagsFromStrings
is a noop. Other APIs are not supported and will throw an error in Deno.
- 🟡
-
⚠️ node:vm- 🟡 Core functionality works, but experimental VM ES modules are not implemented in Bun.
- 🟡 Partial support in Deno
-
❌ node:wasi
- 🔴 Not implemented in both.
-
⚠️ node:worker_threads- 🟡 Worker doesn't support the following options in Bun:
stdin
,stdout
,stderr
,trackedUnmanagedFds
,resourceLimits
. MissingmarkAsUntransferable
,moveMessagePortToContext
,getHeapSnapshot
in Bun. - 🟡 Missing
parentPort.emit
,parentPort.removeAllListeners
,markAsUntransferable
,moveMessagePortToContext
,receiveMessageOnPort
,Worker.prototype.getHeapSnapshot
in Deno.
- 🟡 Worker doesn't support the following options in Bun:
-
⚠️ node:zlib- 🟡 Unoptimized in Bun.
- 🟢 Fully implemented in Deno.
-
✅
AbortController
-
✅
AbortSignal
-
✅
Blob
-
✅
Buffer
-
✅
ByteLengthQueuingStrategy
-
⚠️ __dirname
- 🟢 Fully supported in Bun
- 🔴 Not implemented in Deno
-
⚠️ __filename
- 🟢 Fully supported in Bun
- 🔴 Not implemented in Deno
-
✅
atob()
-
✅
BroadcastChannel
-
✅
btoa()
-
✅
clearImmediate()
-
✅
clearInterval()
-
✅
clearTimeout()
-
❌
CompressionStream
- 🟢 Not implemented in Bun
- 🔴 Fully supported in Deno
-
✅
console
-
✅
CountQueuingStrategy
-
✅
Crypto
-
✅
SubtleCrypto
(crypto) -
✅
CryptoKey
-
✅
CustomEvent
-
❌
DecompressionStream
- 🔴 Not implemented in Bun
- 🟢 Fully supported in Deno
-
✅
Event
-
✅
EventTarget
-
✅
exports
-
✅
fetch
-
✅
FormData
-
✅
global
- 🟡 Fully supported in both (Note: In Bun,
globalThis
aliases toglobal
.)
- 🟡 Fully supported in both (Note: In Bun,
-
✅
globalThis
-
✅
Headers
-
✅
MessageChannel
-
✅
MessageEvent
-
✅
MessagePort
-
✅
module
-
✅
PerformanceEntry
-
✅
PerformanceMark
-
✅
PerformanceMeasure
-
✅
PerformanceObserver
-
🔴
PerformanceObserverEntryList
- 🟢 Fully supported in Bun
- 🔴 Not implemented in Deno
-
❌
PerformanceResourceTiming
-
✅
performance
-
⚠️ process
- 🟡 Partial support in Bun (Missing several methods and features)
- 🟢 Fully supported in Deno
-
✅
queueMicrotask()
-
✅
ReadableByteStreamController
-
✅
ReadableStream
-
✅
ReadableStreamBYOBReader
-
✅
ReadableStreamBYOBRequest
-
✅
ReadableStreamDefaultController
-
✅
ReadableStreamDefaultReader
-
✅
require()
- 🟢 Fully supported in Bun (including
require.main
,require.cache
,require.resolve
) - 🟢 Fully supported in Deno
- 🟢 Fully supported in Bun (including
-
✅
Response
-
✅
Request
-
✅
setImmediate()
-
✅
setInterval()
-
✅
setTimeout()
-
✅
structuredClone()
-
✅
DOMException
-
✅
TextDecoder
-
✅
TextDecoderStream
-
✅
TextEncoder
-
✅
TextEncoderStream
-
✅
TransformStream
-
✅
TransformStreamDefaultController
-
✅
URL
-
✅
URLSearchParams
-
✅
WebAssembly
-
✅
WritableStream
-
✅
WritableStreamDefaultController
-
✅
WritableStreamDefaultWriter
Contributions are welcome! If you have suggestions or improvements, please open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License - see the LICENSE.md file for details.
For questions or feedback, you can reach out to siguici@proton.me.
Buno aims to make cross-runtime development easier and more efficient. We hope you find it useful! 🎉