CLI tool for uploading files to Cloudflare R2 with animated terminal UI and progress tracking
Complete documentation of presigned URL generation and usage.
Upon successful upload, r2put automatically generates a presigned download URL. This URL provides immediate access to the uploaded file without additional authentication.
› OBJECT PATH: production-v4/data.bin
› DOWNLOAD URL:
https://production-v4.abc123.r2.cloudflarestorage.com/data.bin?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...Use the presigned URL directly in browsers or HTTP clients:
# Copy URL from terminal output
curl "https://production-v4.abc123.r2.cloudflarestorage.com/data.bin?X-Amz-..."Capture and use the presigned URL in scripts:
#!/bin/bash
# Upload file
r2put --file ./data.bin --bucket my-bucket > output.txt
# Extract presigned URL (example - actual parsing depends on output format)
URL=$(grep "DOWNLOAD URL:" output.txt | cut -d' ' -f3-)
# Use URL
echo "Download URL: $URL"Use presigned URLs in applications:
// Example: Use presigned URL in web application
const presignedUrl = "https://bucket.account.r2.cloudflarestorage.com/file?X-Amz-...";
// Download file
fetch(presignedUrl)
.then(response => response.blob())
.then(blob => {
// Use blob
});Symptoms:
Resolution:
Symptoms:
Resolution:
Symptoms:
Resolution:
For more control over presigned URLs:
@cfkit/r2 directly to generate URLs with custom expirationIf you need presigned URLs with different expiration or more control:
import { R2 } from '@cfkit/r2';
const r2 = new R2({
accountId: process.env.CLOUDFLARE_ACCOUNT_ID!,
accessKeyId: process.env.R2_ACCESS_KEY_ID!,
secretAccessKey: process.env.R2_SECRET_ACCESS_KEY!,
});
// Generate presigned URL with custom expiration (e.g., 24 hours)
const url = await r2.getPresignedUrl({
bucket: 'my-bucket',
key: 'data.bin',
expiresIn: 86400, // 24 hours in seconds
});
console.log(url);Install with Tessl CLI
npx tessl i tessl/npm-r2put