skillfed

cloudflare-r2

Cloudflare R2 provides production-ready patterns for S3-compatible object storage within Workers. Configure buckets and bindings, then use core APIs like put(), get(), delete(), and list() to manage files, with built-in support for multipart uploads, presigned URLs, CORS, and metadata handling.

Cloudflare R2 helps you set up buckets and Workers bindings for object storage in 5 minutes.

AI-generated summary based on this skill's SKILL.md

196 29 MIT updated by secondsky

Install

secondsky/claude-skills/cloudflare-r2 · repository language: TypeScript

CLI (skillfed)coming soon
git clone https://github.com/secondsky/claude-skills
cp -r claude-skills/plugins/cloudflare-r2/skills/cloudflare-r2 ~/.claude/skills/cloudflare-r2

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I set up Cloudflare R2 storage and configure Workers bindings?

Cloudflare R2 setup begins with creating a bucket in the Cloudflare dashboard, then binding it to your Worker via wrangler.toml using an R2 binding. Once configured, your Worker gains access to core APIs: put() for uploads, get() for downloads, delete() for removal, and list() for enumeration. The binding automatically handles authentication and S3-compatible protocol translation.

What are r2 presigned URLs for uploads and how do I generate them?

Cloudflare R2 presigned URLs allow secure client-side uploads without exposing your Worker credentials. Generate them server-side using the R2 API with an expiration window, then pass the URL to the client for direct PUT requests. This pattern offloads upload bandwidth from your Worker and enables resumable multipart uploads directly from browsers or mobile apps.

How do I troubleshoot CORS, multipart, and R2 errors?

Cloudflare R2 CORS errors typically stem from missing Access-Control-Allow-Origin headers on presigned URLs or incorrect bucket CORS configuration. Multipart upload failures often relate to part size limits or incomplete part lists. Enable detailed error logging in your Worker, check R2 API responses for specific error codes, and verify bucket permissions and binding configuration in wrangler.toml.

Can I migrate data from AWS S3 to Cloudflare R2?

Yes, Cloudflare R2 is S3-compatible, so migration tools and scripts targeting S3 APIs work with R2 endpoints. Use AWS CLI with R2 credentials, write a Worker that reads from S3 and writes to R2, or leverage third-party migration services. R2 pricing eliminates egress fees, making it cost-effective for large-scale migrations from S3.

What file operations does the Cloudflare R2 API support?

Cloudflare R2 provides put() for uploads with metadata and content-type control, get() for downloads with streaming, delete() for single or bulk removal, and list() for bucket enumeration with pagination. Multipart uploads are built-in for large files, and you can set cache-control headers and custom metadata on objects. All operations return structured responses for error handling.

How does Cloudflare R2 compare to AWS S3 for object storage?

Cloudflare R2 offers S3-compatible APIs and eliminates egress fees, making it cheaper for high-bandwidth workloads. It integrates natively with Workers for serverless file handling and provides global edge caching. AWS S3 offers more advanced features like analytics, event notifications, and SQL queries, but R2 focuses on simplicity and cost efficiency for typical object storage needs.

SKILL.md

rendered from the published skill — quoted content, verbatim

Cloudflare R2 Object Storage

Status: Production Ready ✅ | Last Verified: 2025-12-27 | v3.0.0

Contents: [Quick

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 15 files
plugins/cloudflare-r2/skills/cloudflare-r2/SKILL.md
plugins/cloudflare-r2/skills/cloudflare-r2/references/advanced-features.md
plugins/cloudflare-r2/skills/cloudflare-r2/references/cloudflare-access-integration.md
plugins/cloudflare-r2/skills/cloudflare-r2/references/common-patterns.md
plugins/cloudflare-r2/skills/cloudflare-r2/references/cors-configuration.md
plugins/cloudflare-r2/skills/cloudflare-r2/references/data-catalog-iceberg.md
plugins/cloudflare-r2/skills/cloudflare-r2/references/event-notifications.md
plugins/cloudflare-r2/skills/cloudflare-r2/references/performance-optimization.md
plugins/cloudflare-r2/skills/cloudflare-r2/references/r2-sql-integration.md
plugins/cloudflare-r2/skills/cloudflare-r2/references/s3-compatibility.md
plugins/cloudflare-r2/skills/cloudflare-r2/references/setup-guide.md
plugins/cloudflare-r2/skills/cloudflare-r2/references/workers-api.md
plugins/cloudflare-r2/skills/cloudflare-r2/templates/r2-cors-config.json
plugins/cloudflare-r2/skills/cloudflare-r2/templates/r2-multipart-upload.ts
plugins/cloudflare-r2/skills/cloudflare-r2/templates/r2-presigned-urls.ts

Related skills

Tags

s3-alternative serverless-storage object-storage-api file-upload-handling presigned-access multipart-transfers cors-management edge-computing-storage data-query-analytics migration-tooling