BlueForge Docs

client.storage.download

Download a file from a storage bucket.

Signature

class Client {
  storage: {
    download(bucket: string, key: string): Promise<Blob>
  }
}

Parameters

NameTypeRequiredNotes
bucket
stringyesBucket name
key
stringyesObject key to download

Throws

ErrorCondition
NotFoundError
Object does not exist
AuthError
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}