BlueForge Docs

client.storage.createBucket

Create a new storage bucket.

Signature

class Client {
  storage: {
    createBucket(name: string, opts?: { public?: boolean }): Promise<StorageBucket>
  }
}

Parameters

NameTypeRequiredNotes
name
stringyesBucket name (alphanumeric + hyphens)
public
booleannoAllow public access (default false)

Throws

ErrorCondition
ValidationError
Invalid bucket name
ConflictError
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}