Cloudflare R2
bash
npm install @aws-sdk/client-s3 @aws-sdk/s3-request-presignerts
disks: {
r2: {
driver: 'r2',
config: {
bucket: 'my-bucket',
endpoint: 'https://<account-id>.r2.cloudflarestorage.com',
credentials: { accessKeyId: '...', secretAccessKey: '...' },
},
},
},R2 is S3-API compatible, so this driver is a thin wrapper around the s3 driver with sensible defaults baked in:
regiondefaults to'auto'if you don't set onevisibilityis always forced to'private'supportsACLis always forced tofalse
...regardless of what you pass for those three — R2 doesn't support S3-style ACLs, so there's nothing to configure there.
Everything else — getSignedUrl, getSignedUploadUrl, CloudFront-style CDN signing via cdn/cdnUrl — behaves exactly like the S3 driver, since R2Driver extends it.