@arcjet/runtime
v1.4.0
Published
Arcjet runtime detection
Readme
@arcjet/runtime
Arcjet runtime detection.
This package attempts to discover and provide runtime keys as defined by the WinterCG.
What is this?
This is an internal utility to help us figure out what platform we are running on.
It’s a fork of unjs/std-env.
We chose to fork so that we can cut away functionality that we do not use
and keep our dependency tree as light as possible.
We only need the runtime detection.
When should I use this?
You should not use this but use unjs/std-env or one of the
alternatives instead.
This package matches our current needs which are likely different from yours.
Install
This package is ESM only. Install with npm in Node.js:
npm install @arcjet/runtimeUse
import { runtime } from "@arcjet/runtime";
console.log(runtime()); // => "bun" or "node" and suchAPI
This package exports the identifier
runtime.
There is no default export.
This package exports the TypeScript type Runtime.
Runtime
This type represents the runtime environments that can be detected.
Type
type Runtime = "workerd" | "deno" | "node" | "bun" | "edge-light" | "";runtime()
Detects which runtime environment your code is currently running in.
Returns
The detected runtime (string), or an empty string if the runtime could not
be determined.
License
Apache License, Version 2.0 © Arcjet Labs, Inc.
Derivative work based on std-env licensed under
MIT © Pooya Parsa.
Our work cherry picks only what we need.
