r2put
v1.0.1
Published
Futuristic CLI tool for uploading files to Cloudflare R2
Maintainers
Readme
r2put
A futuristic CLI tool for uploading files to Cloudflare R2 with animated progress bars and a polished terminal UI.
Features
- Elegant futuristic TUI with animated progress bars
- Real-time transfer rate and ETA display
- Timestamped log messages with typing animation
- Presigned download URL generation on successful upload
- Built on React Ink for smooth terminal rendering
Installation
npm install r2put
# or
pnpm add r2put
# or
yarn add r2putPrerequisites
Set the following environment variables for R2 authentication:
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"Usage
r2put --file <path> --bucket <name> [options]Options
| Option | Short | Description | Required |
|--------|-------|-------------|----------|
| --file | -f | Path to file to upload | Yes |
| --bucket | -b | Target R2 bucket name | Yes |
| --key | -k | Custom object key (defaults to filename) | No |
| --region | -r | Region hint for display (default: WNAM) | No |
| --help | -h | Show help message | No |
Examples
Upload a file with default object key:
r2put --file ./data.bin --bucket production-v4Upload with custom object key:
r2put -f ./local-image.png -b assets -k images/hero.pngSpecify region for display:
r2put --file ./backup.tar.gz --bucket backups --region ENAMOutput
The CLI displays:
- Header: Cloudflare R2 branding
- File Info: Filename and size
- Progress Bar: Animated upload progress with percentage
- Stats: Transfer rate and estimated time remaining
- Log Messages: Timestamped status updates
- Footer: Bucket, encryption, and region info
- Result: Object path and presigned download URL on completion
Example Output
C L O U D F L A R E R 2
ULTRA-LOW LATENCY OBJECT STORAGE
› Uploading: neural-net-weights.bin [4.2 GB]
✔ COMPLETE 95%
████████████████████████████████████████░░░░░░░░░░░░░░░░░░░░
TRANSFER RATE: 842.4 MB/S EST. TIME: 4.2S
[13:53:02] › Initializing secure handshake with R2-E1...
[13:53:02] › Payload delivered. Starting edge-layer optimization.
[13:53:05] ✔ Deployment finalized. Resource available at edge node.
◘ BUCKET ○ ENCRYPTION ◈ REGION
production-v4 AES-256-GCM WNAM (EDGE)
╔═══════════════════════════════════════════════════════════╗
║ UPLOAD COMPLETE ║
║ ║
║ OBJECT PATH ║
║ production-v4/neural-net-weights.bin ║
║ ║
║ PRESIGNED DOWNLOAD URL ║
║ https://...r2.cloudflarestorage.com/... ║
║ ║
╚═══════════════════════════════════════════════════════════╝Environment Variables
| Variable | Description |
|----------|-------------|
| CLOUDFLARE_ACCOUNT_ID | Your Cloudflare Account ID |
| R2_ACCESS_KEY_ID | R2 API Access Key ID |
| R2_SECRET_ACCESS_KEY | R2 API Secret Access Key |
Development
# Install dependencies
pnpm install
# Build the CLI
pnpm build
# Watch for changes
pnpm dev
# Type check
pnpm typecheckRelated
- @cfkit/r2 - Cloudflare R2 API wrapper
License
MIT
