CLI tool for uploading files to Cloudflare R2 with animated terminal UI and progress tracking
npx @tessl/cli install tessl/npm-r2put@1.0.0CLI tool for uploading files to Cloudflare R2 with animated terminal UI, progress bars, and presigned download URLs.
# Install
npm install r2put
# Set credentials
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"
# Upload file
r2put --file ./data.bin --bucket production-v4See Quick Start Guide for detailed setup instructions.
Execution Model:
0 on success, 1 on errorRequired Environment Variables:
CLOUDFLARE_ACCOUNT_ID: Cloudflare Account IDR2_ACCESS_KEY_ID: R2 API Access Key IDR2_SECRET_ACCESS_KEY: R2 API Secret Access KeyDefault Behaviors:
--file if --key not specifiedWNAM (display only, doesn't affect upload)application/octet-stream for unknown extensionsuploaded-at (ISO 8601) and original-filenameLifecycle:
r2put --file <path> --bucket <name> [--key <key>] [--region <region>] [--help]Options:
--file, -f <path> - Path to file to upload (required)--bucket, -b <name> - Target R2 bucket name (required)--key, -k <key> - Custom object key (optional, defaults to filename)--region, -r <region> - Region hint for display (optional, default: "WNAM")--help, -h - Show help messageSee CLI Interface Reference for complete documentation.
npm install r2put # Global
npm install r2put --save-dev # Local
npx r2put # Without installation# Upload with default key
r2put --file ./data.bin --bucket production-v4
# Upload with custom key
r2put -f ./image.png -b assets -k images/hero.png
# Specify region hint
r2put --file ./backup.tar.gz --bucket backups --region ENAM0 - Upload completed successfully1 - Error occurred (missing arguments, file not found, missing credentials, upload failed, etc.)r2put displays an animated terminal interface with:
See Terminal UI Reference for details.
Automatically detects content types from file extensions. See MIME Detection Reference for supported mappings.
Files include metadata:
uploaded-at: ISO 8601 timestamporiginal-filename: Original filenameSee Metadata Reference for details.
Generated automatically on successful upload:
See Presigned URLs Reference for details.
Programmatic Usage: r2put is CLI-only and does not export a programmatic API. For programmatic access, use the @cfkit/r2 package directly.
Non-Interactive Environments: Terminal UI may not render correctly in CI/CD. Consider using @cfkit/r2 directly for programmatic control.
Common issues and solutions:
See Error Handling Reference for comprehensive troubleshooting.