Storage
R2 object storage with presigned uploads and downloads
Overview
Each project can have one or more storage buckets backed by Cloudflare R2. The SDK provides methods to manage buckets, list objects, and generate presigned URLs for secure uploads and downloads.
All storage methods are available on r.storage.
Methods
List buckets
Parameters:
Get a bucket
Create a bucket
Input fields:
Ensure a bucket (idempotent)
Creates the bucket if it does not exist, or returns the existing one. Use this in deployment scripts.
ensureBucket is idempotent. Calling it multiple times with the same project and name will not create duplicates.
List items
Parameters:
Returns: SingleResponse<StorageBucketItem[]>
Create a folder
Upload a file (presigned URL)
Uploads use a two-step process: first get a presigned URL from the API, then PUT the file directly to R2.
Input fields: