client.storage.upload
Upload a file to a storage bucket.
Signature
class Client {
storage: {
upload(bucket: string, key: string, file: File | Blob | Buffer, opts?: {
mimeType?: string
autoTag?: boolean
generateEmbedding?: boolean
}): Promise<StorageUploadResult>
}
}
Parameters
| Name | Type | Required | Notes |
|---|---|---|---|
| string | yes | Bucket name |
| string | yes | Object key (path within bucket) |
| File / Blob / Buffer | yes | File data |
| string | no | Override content type |
| boolean | no | Auto-generate tags via AI |
| boolean | no | Generate vector embedding for semantic search |
Throws
| Error | Condition |
|---|---|
| Bucket does not exist |
| Invalid or expired API key |
| File exceeds size limit (100 MB) |
Examples
const result = await bf.storage.upload('assets', 'images/logo.png', file, {
mimeType: 'image/png',
autoTag: true,
})
console.log(`Uploaded ${result.size} bytes`)
Pitfalls
- Size limit — 100 MB per upload; use multipart for larger files
- Key uniqueness — uploading to the same key overwrites the existing object
- Embedding cost —
incurs AI processing time and costgenerateEmbedding
See also
{auto-injected}
Tested against
{auto-injected}