← ClaudeAtlas

cloudflare-workers-runtime-apislisted

Cloudflare Workers Runtime APIs including Fetch, Streams, Crypto, Cache, WebSockets, and Encoding. Use for HTTP requests, streaming, encryption, caching, real-time connections, or encountering API compatibility, response handling, stream processing errors.
secondsky/claude-skills · ★ 248 · DevOps & Infrastructure · score 90
Install: claude install-skill secondsky/claude-skills
# Cloudflare Workers Runtime APIs Master the Workers runtime APIs: Fetch, Streams, Crypto, Cache, WebSockets, and text encoding. ## Quick Reference | API | Purpose | Common Use | |-----|---------|------------| | **Fetch** | HTTP requests | External APIs, proxying | | **Streams** | Data streaming | Large files, real-time | | **Crypto** | Cryptography | Hashing, signing, encryption | | **Cache** | Response caching | Performance optimization | | **WebSockets** | Real-time connections | Chat, live updates | | **Encoding** | Text encoding | UTF-8, Base64 | ## Quick Start: Fetch API ```typescript export default { async fetch(request: Request, env: Env): Promise<Response> { // Basic fetch const response = await fetch('https://api.example.com/data'); // With options const postResponse = await fetch('https://api.example.com/users', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${env.API_KEY}`, }, body: JSON.stringify({ name: 'John' }), }); // Clone for multiple reads const clone = response.clone(); const json = await response.json(); const text = await clone.text(); return Response.json(json); } }; ``` ## Critical Rules 1. **Always set timeouts for external requests** - Workers have a 30s limit, external APIs can hang 2. **Clone responses before reading body** - Body can only be read once 3. **Use streaming for large payloads** - Don't buffer entire