Skip to main content
The Storage module provides file upload and management capabilities scoped to the current room. Files are stored in Cloudflare R2 and served via HTTP. Access it via client.storage.
Unlike other modules, Storage operations use HTTP requests rather than WebSocket messages.
Editors can upload and delete files. Viewers can list and read files, but upload and delete are blocked client-side for viewer sessions.

Methods

Upload File

upload({ file }) Upload a file to the current room:
Returns an UploadResult.

Get File URL

getUrl({ key }) Get the URL for a previously uploaded file:

List Files

getAll(opts?) List all files in the current room, optionally filtered:
Returns an array of StorageFile objects.

Delete File

delete({ key }) Delete a file by its storage key:

Examples