Edge Runtime APIs
The following APIs are available in the Edge Runtime.
Network APIs
- Blob (opens in a new tab)
- Event (opens in a new tab)
- EventTarget (opens in a new tab)
- fetch (opens in a new tab)
- FetchEvent (opens in a new tab)
- File (opens in a new tab)
- FormData (opens in a new tab)
- Headers (opens in a new tab)
- PromiseRejectionEvent (opens in a new tab)
- Request (opens in a new tab)
- Response (opens in a new tab)
- WebSocket (opens in a new tab)
Encoding APIs
- TextDecoder (opens in a new tab)
- TextDecoderStream (opens in a new tab)
- TextEncoder (opens in a new tab)
- TextEncoderStream (opens in a new tab)
- atob (opens in a new tab)
- btoa (opens in a new tab)
Web Stream APIs
- ReadableStream (opens in a new tab)
- ReadableStreamBYOBReader (opens in a new tab)
- ReadableStreamDefaultReader (opens in a new tab)
- TransformStream (opens in a new tab)
- WritableStream (opens in a new tab)
- WritableStreamDefaultWriter (opens in a new tab)
Web Crypto APIs
Web Standards APIs
- AbortController (opens in a new tab)
- AbortSignal (opens in a new tab)
- DOMException (opens in a new tab)
- structuredClone (opens in a new tab)
- URLPattern (opens in a new tab)
V8 Primitives
- Array (opens in a new tab)
- ArrayBuffer (opens in a new tab)
- Atomics (opens in a new tab)
- BigInt (opens in a new tab)
- BigInt64Array (opens in a new tab)
- BigUint64Array (opens in a new tab)
- Boolean (opens in a new tab)
- clearInterval (opens in a new tab)
- clearTimeout (opens in a new tab)
- console (opens in a new tab)
- DataView (opens in a new tab)
- Date (opens in a new tab)
- decodeURI (opens in a new tab)
- decodeURIComponent (opens in a new tab)
- encodeURI (opens in a new tab)
- encodeURIComponent (opens in a new tab)
- Error (opens in a new tab)
- EvalError (opens in a new tab)
- Float32Array (opens in a new tab)
- Float64Array (opens in a new tab)
- Function (opens in a new tab)
- Infinity (opens in a new tab)
- Int8Array (opens in a new tab)
- Int16Array (opens in a new tab)
- Int32Array (opens in a new tab)
- Intl (opens in a new tab)
- isFinite (opens in a new tab)
- isNaN (opens in a new tab)
- JSON (opens in a new tab)
- Map (opens in a new tab)
- Math (opens in a new tab)
- Number (opens in a new tab)
- Object (opens in a new tab)
- parseFloat (opens in a new tab)
- parseInt (opens in a new tab)
- Promise (opens in a new tab)
- Proxy (opens in a new tab)
- queueMicrotask (opens in a new tab)
- RangeError (opens in a new tab)
- ReferenceError (opens in a new tab)
- Reflect (opens in a new tab)
- RegExp (opens in a new tab)
- Set (opens in a new tab)
- setInterval (opens in a new tab)
- setTimeout (opens in a new tab)
- SharedArrayBuffer (opens in a new tab)
- String (opens in a new tab)
- Symbol (opens in a new tab)
- SyntaxError (opens in a new tab)
- TypeError (opens in a new tab)
- Uint8Array (opens in a new tab)
- Uint8ClampedArray (opens in a new tab)
- Uint16Array (opens in a new tab)
- Uint32Array (opens in a new tab)
- URIError (opens in a new tab)
- URL (opens in a new tab)
- URLSearchParams (opens in a new tab)
- WeakMap (opens in a new tab)
- WeakSet (opens in a new tab)
- WebAssembly (opens in a new tab)
Addressing the runtime
In addition to the above-mentioned APIs, a globalThis.EdgeRuntime
property is also available that can be used to address the runtime:
if (typeof EdgeRuntime !== 'string') {
// dead-code elimination is enabled for the code inside this block
}
Unsupported APIs
The Edge Runtime has some restrictions including:
- Native Node.js APIs are not supported. For example, you can't read or write to the filesystem
node_modules
can be used, as long as they implement ES Modules and do not use native Node.js APIs- Calling
require
directly is not allowed. Use ES Modules instead
The following JavaScript language features are disabled, and will not work:
eval
: Evaluates JavaScript code represented as a stringnew Function(evalString)
: Creates a new function with the code provided as an argument