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.
- Cache: Control reading and writing from the Cloudflare global network cache.
- Console: Supported methods of the
console
API in Cloudflare Workers - Durable Objects: A globally distributed coordination API with strongly consistent storage.
- 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.
- KV: Global, low-latency, key-value data storage.
- mTLS: Configure your Worker to present a client certificate to services that enforce an mTLS connection.
- 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.
- Queues: Send and receive messages with guaranteed delivery.
- R2: APIs available in Cloudflare Workers to read from and write to R2 buckets. R2 is S3-compatible, zero egress-fee, globally distributed object storage.
- Request: Interface that represents an HTTP request.
- Response: Interface that represents an HTTP response.
- Service bindings: Facilitate Worker-to-Worker communication.
- 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.