client.storage.createBucket
Create a new storage bucket.
Signature
class Client {
storage: {
createBucket(name: string, opts?: { public?: boolean }): Promise<StorageBucket>
}
}
Parameters
| Name | Type | Required | Notes |
|---|---|---|---|
| string | yes | Bucket name (alphanumeric + hyphens) |
| boolean | no | Allow public access (default false) |
Throws
| Error | Condition |
|---|---|
| Invalid bucket name |
| Bucket name already exists |
Examples
const bucket = await bf.storage.createBucket('user-uploads', { public: true })
console.log(`Created bucket ${bucket.name}`)
Pitfalls
- Name uniqueness — bucket names must be unique within the project
- Public visibility — public buckets allow unauthenticated read access via CDN
See also
{auto-injected}
Tested against
{auto-injected}