client.storage.getPublicUrl
Get a CDN public URL with optional image transforms.
Signature
class Client {
storage: {
getPublicUrl(bucket: string, key: string, opts?: {
w?: number
h?: number
format?: string
}): string | null
}
}
Parameters
| Name | Type | Required | Notes |
|---|---|---|---|
| string | yes | Bucket name |
| string | yes | Object key |
| number | no | Resize width (pixels) |
| number | no | Resize height (pixels) |
| string | no | Output format: , , |
Examples
const url = bf.storage.getPublicUrl('assets', 'images/logo.png', { w: 200, h: 200, format: 'webp' })
// → https://cdn.blueforge.dev/assets/images/logo.png?w=200&h=200&format=webp
Throws
| Error | Condition |
|---|---|
| API request failed |
| Network issue |
Pitfalls
- Null for private objects — returns null if the bucket is private and no CDN URL is configured
- Transform cost — image transforms are billed per-operation
See also
{auto-injected}
Tested against
{auto-injected}