Cloudflare Docs
Workers
Edit this page on GitHub
Set theme to dark (⇧+D)

Runtime APIs

The Workers runtime is designed to be JavaScript standards compliant and web-interoperable. Wherever possible, it uses web platform APIs, so that code can be reused across client and server, as well as across WinterCG JavaScript runtimes.

The Workers runtime also implements a subset of Node.js APIs as an optional, opt-in compatibility layer.

  • Bindings (env): Worker Bindings that allow for interaction with other Cloudflare Resources.
  • Cache: Control reading and writing from the Cloudflare global network cache.
  • Console: Supported methods of the console API in Cloudflare Workers
  • Context (ctx): The Context API in Cloudflare Workers, including waitUntil and passThroughOnException.
  • Encoding: Takes a stream of code points as input and emits a stream of bytes.
  • Fetch: An interface for asynchronously fetching resources via HTTP requests inside of a Worker.
  • Handlers: Methods, such as fetch(), on Workers that can receive and process external inputs.
  • Headers: Access HTTP request and response headers.
  • HTMLRewriter: Build comprehensive and expressive HTML parsers inside of a Worker application.
  • Node.js compatibility: Implemented Node.js runtime APIs and enablement instructions for your Worker project.
  • Performance and timers: Measure timing, performance, and timing of subrequests and other operations.
  • Remote-procedure call (RPC): The built-in, JavaScript-native RPC system built into Workers and Durable Objects.
  • Request: Interface that represents an HTTP request.
  • Response: Interface that represents an HTTP response.
  • Streams: A web standard API that allows JavaScript to programmatically access and process streams of data.
  • TCP sockets: Use the connect() API to create outbound TCP connections from Workers.
  • Web Crypto: A set of low-level functions for common cryptographic tasks.
  • Web standards: Standardized APIs for use by Workers running on Cloudflare's global network.
  • WebAssembly (Wasm): Execute code written in a language other than JavaScript or write an entire Cloudflare Worker in Rust.
  • WebSockets: Communicate in real time with your Cloudflare Workers.