cf-r2-file
Installation
SKILL.md
cf-r2-file
Upload a local file to the existing R2 bucket public. Return the public URL. Copy it to the clipboard.
Wrangler is already installed globally (bun add -g wrangler) and already authenticated (wrangler login). Bucket public already exists. Custom domain assets.shahram.dev is already attached. Do not log in, create a bucket, or attach a domain.
Steps
-
Resolve the local file to an absolute path. Confirm it exists. Done when: the path is absolute and the file is on disk.
-
Build the object key from a 24-byte hex prefix plus the original extension:
$(openssl rand -hex 24).${EXT}Done when: key is{48-hex-chars}.{ext}with no original basename. -
PUT to the live bucket (Wrangler v4 is local unless
--remote):