CDN acceleration
Static files are cached and delivered via CDN; public buckets can use custom domains as entry points.
Upload images, documents, and media; control access with security rules or RLS; deliver via CDN, image processing, and signed links.
Cache policy · custom domain
Resize · crop · format conversion
Images · video · text
Your app cares about objects and paths; CloudBase enforces policies at the access layer and delivers files for public or private scenarios.
Bucket · object path · metadata
Security rules or PostgreSQL RLS
CDN · public URL · signed link
Covers the storage, processing, permissions, and delivery primitives you use most across the file lifecycle.
Static files are cached and delivered via CDN; public buckets can use custom domains as entry points.
Use CI parameters for resize, crop, rotate, format conversion, and quality control — no need to pre-generate every size.
Standard mode uses file-level security rules; PG mode uses RLS policies on storage.objects and storage.buckets.
Private buckets can generate time-limited links for specific objects, with optional download filenames.
Upload, download, list, copy, move, and delete objects — organize business files by bucket and path.
Configure moderation workflows for images, video, audio, text, and documents with CI.
Storage isn't done when upload succeeds — it's when the right person gets the file at the right time, the right way.Product design principle
Choose access by bucket and scenario; permission checks always happen before delivery.
View access and downloadExamples follow in-repo SDK and image processing docs; product scope matches current documentation.
In PG mode, app.storage.from(bucketId) returns the object client; paths are always relative to the bucket.
import cloudbase from '@cloudbase/js-sdk'
const app = cloudbase.init({ env: '<envId>' })
const bucket = app.storage.from('avatars')
const { data, error } = await bucket.upload(
`${user.id}/avatar.png`,
file,
{
contentType: 'image/png',
upsert: true,
metadata: { usage: 'avatar' }
}
)
if (error) throw errorSigned links limit downloads to a specific object and expiry — ideal for invoices, reports, and user attachments.
const bucket = app.storage.from('private-files')
const { data, error } =
await bucket.createSignedUrl(
`${user.id}/report.pdf`,
600,
{ download: 'report.pdf' }
)
if (error) throw error
window.location.assign(data.signedUrl)Append CI processing parameters to the image URL to combine resize, format conversion, and quality control.
const source =
'https://<domain>/images/cover.jpg'
const thumbnail =
source +
'?imageMogr2/thumbnail/640x640' +
'/format/webp/rquality/80'
// 在请求时按需缩放、转格式与控制质量
image.src = thumbnailThe same object data can reach Web, mini programs, server-side code, and content processing pipelines.
Avatars, attachments, reports, and user-generated content.
Images, scripts, download packages, and static media.
Image processing, document preview, and content moderation.
Create a bucket, choose a permission model, then start with your first upload API.