Get started with r2put in minutes.
Install r2put globally or locally:
# Global installation
npm install -g r2put
# Local installation
npm install r2put --save-dev
# Or use without installation
npx r2putYou need a Cloudflare R2 account with:
Create these in the Cloudflare dashboard under R2 > Manage R2 API Tokens.
Set the required environment variables:
export CLOUDFLARE_ACCOUNT_ID="your-account-id"
export R2_ACCESS_KEY_ID="your-access-key-id"
export R2_SECRET_ACCESS_KEY="your-secret-access-key"For persistent setup, add these to your shell profile (~/.bashrc, ~/.zshrc, etc.).
Upload a file with default object key (uses filename):
r2put --file ./data.bin --bucket production-v4Specify a custom object key:
r2put --file ./local-image.png --bucket assets --key images/hero.pngUse short flag aliases:
r2put -f ./backup.tar.gz -b backups -k "backups/$(date +%Y%m%d).tar.gz"On successful upload, r2put displays:
bucket/objectKeyThe presigned URL can be used immediately to download the file.