client.storage.download
Download a file from a storage bucket.
Signature
class Client {
storage: {
download(bucket: string, key: string): Promise<Blob>
}
}
Parameters
| Name | Type | Required | Notes |
|---|---|---|---|
| string | yes | Bucket name |
| string | yes | Object key to download |
Throws
| Error | Condition |
|---|---|
| Object does not exist |
| Invalid or expired API key |
Examples
const blob = await bf.storage.download('assets', 'images/logo.png')
const buffer = Buffer.from(await blob.arrayBuffer())
Pitfalls
- Memory usage — the full object is loaded into memory. Use the CDN URL for large files.
See also
{auto-injected}
Tested against
{auto-injected}