Crypto Edge
    Preparing search index...

    Function detectRuntime

    • Detect the current JavaScript runtime environment.

      Detection heuristics (checked in order):

      1. Cloudflare Workers -- presence of the caches global and the navigator.userAgent string "Cloudflare-Workers".
      2. Vercel Edge -- the EdgeRuntime global string (set by Vercel).
      3. Deno -- the Deno global namespace.
      4. Bun -- the Bun global namespace.
      5. Browser -- window exists and document exists.
      6. Node.js -- process.versions.node exists.
      7. Unknown -- none of the above matched.

      Returns EdgeRuntime

      The detected EdgeRuntime identifier.

      import { detectRuntime } from "@aspect/crypto-edge";

      const runtime = detectRuntime();
      console.log(runtime); // "node", "cloudflare-workers", "deno", etc.