Concepts
Objects
Upload, download, copy, list, and delete objects.
An object is a file stored under a key within a bucket. Keys may contain /
to model folders (e.g. users/42/avatar.png).
Upload & download
await storage.objects.upload({
bucket: "avatars",
key: "users/42.png",
body: file,
contentType: "image/png",
metadata: { uploadedBy: "user-42" }, // sent as x-metadata-* headers
});
const res = await storage.objects.download("avatars", "users/42.png");For files above 10 MiB the SDK automatically switches to multipart upload.
List
Cursor-paginated, filtered by prefix:
const { data, cursor } = await storage.objects.list({
bucket: "avatars",
prefix: "users/",
limit: 100,
});Copy & delete
await storage.objects.copy("avatars", "users/42.png", "users/42-backup.png");
await storage.objects.delete("avatars", "users/42.png");Batch operations
// via REST
// POST /v1/buckets/avatars/objects/batch-delete { "keys": ["a.png","b.png"] }Key rules
- Keys are UTF-8, up to 1024 bytes.
- Leading slashes,
..segments, and control characters are rejected. - Slashes are preserved as path separators.