Skip to content

Cloudflare R2

Verified

Upload files to Cloudflare R2 storage using wrangler CLI. Use when needing to upload images, videos, or files to R2 for CDN hosting, or manage R2 bucket contents. Triggers on "upload to R2", "upload to Cloudflare", "上传到R2", "存到CDN".

724 downloads
$ Add to .claude/skills/

About This Skill

# Cloudflare R2

Upload and manage files in Cloudflare R2 storage buckets.

Prerequisites

  • `wrangler` CLI: `npm install -g wrangler`
  • R2 config at `~/.config/cloudflare/r2.json`

Config Format

```json { "bucket": "your-bucket-name", "accountId": "your-account-id", "publicDomain": "pub-xxx.r2.dev", "apiToken": "your-api-token" } ```

Quick Upload

Single file: ```bash scripts/r2-upload.sh <local-file> [remote-path] ```

Batch upload: ```bash scripts/r2-upload.sh <directory> <remote-prefix> ```

Manual Commands

```bash # Set credentials export CLOUDFLARE_ACCOUNT_ID="$(jq -r .accountId ~/.config/cloudflare/r2.json)" export CLOUDFLARE_API_TOKEN="$(jq -r .apiToken ~/.config/cloudflare/r2.json)" BUCKET=$(jq -r .bucket ~/.config/cloudflare/r2.json)

# Upload wrangler r2 object put "$BUCKET/path/to/file.png" --file local.png --remote

# List objects wrangler r2 object list $BUCKET --prefix "path/" --remote

# Delete wrangler r2 object delete "$BUCKET/path/to/file.png" --remote ```

Public URL

After upload, files are accessible at: ``` https://<publicDomain>/<remote-path> ```

Example: `https://pub-xxx.r2.dev/article/image.png`

Use Cases

  • Upload files to Cloudflare R2 storage buckets from an agent workflow
  • Manage R2 bucket contents including listing, downloading, and deleting objects
  • Store agent-generated artifacts like reports and images in R2 for web access
  • Configure R2 bucket settings and access policies programmatically
  • Migrate files between local storage and R2 as part of deployment automation

Pros & Cons

Pros

  • +Direct R2 integration using the wrangler CLI for reliable file operations
  • +JSON-based configuration file keeps credentials organized
  • +S3-compatible storage means broad tooling ecosystem support

Cons

  • -Requires wrangler CLI to be globally installed via npm
  • -Only available on claude-code and openclaw platforms
  • -R2 configuration file at ~/.config/cloudflare/r2.json must be set up manually

FAQ

What does Cloudflare R2 do?
Upload files to Cloudflare R2 storage using wrangler CLI. Use when needing to upload images, videos, or files to R2 for CDN hosting, or manage R2 bucket contents. Triggers on "upload to R2", "upload to Cloudflare", "上传到R2", "存到CDN".
What platforms support Cloudflare R2?
Cloudflare R2 is available on Claude Code, OpenClaw.
What are the use cases for Cloudflare R2?
Upload files to Cloudflare R2 storage buckets from an agent workflow. Manage R2 bucket contents including listing, downloading, and deleting objects. Store agent-generated artifacts like reports and images in R2 for web access.

100+ free AI tools

Writing, PDF, image, and developer tools — all in your browser.

Next Step

Use the skill detail page to evaluate fit and install steps. For a direct browser workflow, move into a focused tool route instead of staying in broader support surfaces.