
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
detect-runtime
Advanced tools
Detects the current runtime environment (Node.js, Cloudflare Workers, Deno, ...)
Small library to detect the current JavaScript runtime. The list of supported runtimes is based on the WinterCG Runtime Keys proposal:
edge-routine Alibaba Cloud Edge Routineworkerd Cloudflare Workersdeno Deno and Deno Deploylagon Lagonreact-native React Nativenetlify Netlify Edge Functionselectron Electronnode Node.jsbun Bunedge-light Vercel Edge Functionsfastly Fastly Compute@EdgeThis package is properly typed and exported to both ESM and CJS.
detect-runtime is published on NPM:
# NPM
npm install detect-runtime
# Yarn
yarn add detect-runtime
# PNPM
pnpm install detect-runtime
# Bun
bun install detect-runtime
Or in Deno:
import { ... } from 'npm:detect-runtime'
Import and call the detectRuntime() function from the detect-runtime package:
import { detectRuntime } from 'detect-runtime'
const runtime = detectRuntime()
// ^? 'edge-routine' | 'workerd' | 'deno' | 'lagon' | 'react-native' | 'netlify | 'electron | 'node | 'bun | 'edge-light | 'unknown'
You can also import the Runtime type which is the return type of detectRuntime().
FAQs
Detects the current runtime environment (Node.js, Cloudflare Workers, Deno, ...)
The npm package detect-runtime receives a total of 2,878 weekly downloads. As such, detect-runtime popularity was classified as popular.
We found that detect-runtime demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.