Detect the current JavaScript runtime environment.
Detection heuristics (checked in order):
caches
navigator.userAgent
"Cloudflare-Workers"
EdgeRuntime
Deno
Bun
window
document
process.versions.node
The detected EdgeRuntime identifier.
import { detectRuntime } from "@aspect/crypto-edge";const runtime = detectRuntime();console.log(runtime); // "node", "cloudflare-workers", "deno", etc. Copy
import { detectRuntime } from "@aspect/crypto-edge";const runtime = detectRuntime();console.log(runtime); // "node", "cloudflare-workers", "deno", etc.
Detect the current JavaScript runtime environment.
Detection heuristics (checked in order):
cachesglobal and thenavigator.userAgentstring"Cloudflare-Workers".EdgeRuntimeglobal string (set by Vercel).Denoglobal namespace.Bunglobal namespace.windowexists anddocumentexists.process.versions.nodeexists.