⚙️ Cross-Platform JavaScript/TypeScript Runtime Adapter
MIT License
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.
fs
, path
, etc.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
⚠️ node:async_hooks
AsyncLocalStorage
, and AsyncResource
are implemented.AsyncResource
is missing bind in Bun.AsyncLocalStorage
is supported. AsyncResource
, executionAsyncId
,createHook
are non-functional stubs in Deno.✅ node:buffer
⚠️ node:child_process
proc.gid
, proc.uid
. Stream class not exported.❌ node:cluster
✅ node:console
⚠️ node:crypto
Certificate
, ECDH
, X509Certificate
,Certificate class
, crypto.Cipheriv.prototype.setAutoPadding
,crypto.Decipheriv.prototype.setAutoPadding
, crypto.publicDecrypt
,crypto.ECDH.prototype.convertKey
, x448
option for generateKeyPair
,crypto.KeyObject
, and other methods in Deno.⚠️ node:dgram
setBroadcast
, setTTL
, setMulticastTTL
,✅ node:diagnostics_channel
⚠️ node:dns
cancel
, setServers
, getDefaultResultOrder
in Bun.dns.resolve*
with ttl
option in Deno.⚠️ node:domain
⚠️ node:events
events.addAbortListener
& events.getMaxListeners
EventTarget
in Bun.⚠️ node:fs
statfs
, statfsSync
, opendirSync
.utf16le
, latin1
, and ucs2
encoding for fs.writeFile
and fs.writeFileSync
.lchmod
is missing in fs/promises
in Deno.✅ node:http
⚠️ node:http2
grpc-js
in Deno.⚠️ node:https
Missing https.Server.opts.cert
and https.Server.opts.key
array type in Deno.❌ node:inspector
⚠️ node:module
runMain
, syncBuiltinESMExports
, Module#load()
.register()
function is not supported in Deno.⚠️ node:net
SocketAddress
Stream
, BlockList
is a no-op in Bun.net.Socket.prototype.constructor
with fd
option in Deno.✅ node:os
✅ node:path
⚠️ node:perf_hooks
createHistogram
, monitorEventLoopDelay
in Bun.perf_hooks.eventLoopUtilization
, perf_hooks.timerify
,perf_hooks.monitorEventLoopDelay
in Deno.⚠️ node:process
process
Global in Bun.multipleResolves
, worker
events in Deno.✅ node:punycode
✅ node:querystring
✅ node:readline
❌ node:repl
builtinModules
and _builtinLibs
are supported.REPLServer.prototype.constructor
and start()
in Deno.⚠️ node:stream
getDefaultHighWaterMark
, setDefaultHighWaterMark
, toWeb
in Bun.✅ node:string_decoder
✅ node:sys
❌ node:test
bun:test
instead.✅ node:timers
⚠️ node:tls
createSecurePair
in both.❌ node:trace_events
✅ node:tty
⚠️ node:util
MIMEParams
, MIMEType
, aborted
, debug
, getSystemErrorMap
,transferableAbortController
, transferableAbortSignal
in Bun.aborted
, transferableAbortSignal
, transferableAbortController
,MIMEParams
, MIMEType
and getSystemErrorMap
in Deno.✅ node:url
❌ node:v8
serialize
and deserialize
use JavaScriptCore's wire formatcachedDataVersionTag
and getHeapStatistics
are supported. setFlagsFromStrings
⚠️ node:vm
❌ node:wasi
⚠️ node:worker_threads
stdin
, stdout
, stderr
, trackedUnmanagedFds
, resourceLimits
.markAsUntransferable
, moveMessagePortToContext
,getHeapSnapshot
in Bun.parentPort.emit
, parentPort.removeAllListeners
,markAsUntransferable
, moveMessagePortToContext
, receiveMessageOnPort
,Worker.prototype.getHeapSnapshot
in Deno.⚠️ node:zlib
✅ 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
aliases to global
.)✅ globalThis
✅ Headers
✅ MessageChannel
✅ MessageEvent
✅ MessagePort
✅ module
✅ PerformanceEntry
✅ PerformanceMark
✅ PerformanceMeasure
✅ PerformanceObserver
🔴 PerformanceObserverEntryList
❌ PerformanceResourceTiming
✅ performance
⚠️ process
✅ queueMicrotask()
✅ ReadableByteStreamController
✅ ReadableStream
✅ ReadableStreamBYOBReader
✅ ReadableStreamBYOBRequest
✅ ReadableStreamDefaultController
✅ ReadableStreamDefaultReader
✅ require()
require.main
, require.cache
, require.resolve
)✅ 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 [email protected].
Buno aims to make cross-runtime development easier and more efficient. We hope you find it useful! 🎉