Detect the current runtime environment.
Detection order (first match wins):
Bun
Deno
window
process.versions.node
RuntimeInfo with detected environment details
const info = detectRuntime()if (info.runtime === Runtime.Bun) { console.log(`Running on Bun ${info.version}`)} Copy
const info = detectRuntime()if (info.runtime === Runtime.Bun) { console.log(`Running on Bun ${info.version}`)}
Detect the current runtime environment.
Detection order (first match wins):
BunglobalDenoglobalwindowand browser-specific APIsprocess.versions.node