Skip to main content
Beta

This feature is in beta. Core behavior is stable, but some APIs or configuration may change before general availability.

Storage

JavaScriptDartSwiftKotlinJavaScalaPythonGoPHPRustC#C++RubyElixir

EdgeBase Storage provides file storage built on Cloudflare R2 with $0 egress fees. Upload and download files with per-bucket access rules, generate time-limited signed URLs for secure sharing without authentication, and handle large files with resumable multipart uploads. Attach custom metadata to any file and control access with auth-aware read, write, and delete rules.


Control Surface
  • Access Rules: Storage Access Rules gate bucket reads, uploads, and deletes.
  • Hooks: Storage Hooks validate uploads, restrict downloads, and run file lifecycle side effects.
  • Triggers: Storage is not a trigger-based surface.
  • Handlers: Inline storage behavior lives under storage.buckets[name].handlers.hooks in edgebase.config.ts.

Features

📤

Upload / Download

Simple file operations with per-bucket access rules

🔗

Signed URLs

Time-limited access links for secure sharing (no auth required)

📎

Multipart Upload

Resume-capable uploads for large files (state tracked via KV)

🏷️

Metadata

Attach custom key-value metadata to any file

🔒

Access Rules

Per-bucket read, write, delete rules with auth context

🪝

Storage Hooks

Validate uploads, restrict downloads, and run post-upload or delete side effects

Quick Example

Assume client is already initialized with your platform SDK.

const result = await client.storage.bucket('photos').upload('photo-001.jpg', file, {
customMetadata: { uploadedBy: currentUser.id },
});

const url = client.storage.bucket('photos').getUrl('photo-001.jpg');

const blob = await client.storage.bucket('photos').download('photo-001.jpg');
// Signed URL (no auth needed to access)
const signedUrl = await admin.storage.bucket('photos').createSignedUrl('photo-001.jpg', {
expiresIn: '1h',
});
Admin SDK Coverage

Server-side storage operations such as signed URL generation and privileged file access are available across all Admin SDKs.

Access Rules

// edgebase.config.ts
storage: {
buckets: {
photos: {
access: {
read() { return true }, // Public read
write(auth) { return auth !== null }, // Auth required
delete(auth, file) { return auth !== null && auth.id === file.uploadedBy },
},
},
},
}

Next Steps