BlueForge Docs

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

NameTypeRequiredNotes
bucket
stringyesBucket name
key
stringyesObject key
w
numbernoResize width (pixels)
h
numbernoResize height (pixels)
format
stringnoOutput format:
webp
,
png
,
jpeg

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

ErrorCondition
ApiError
API request failed
NetworkError
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}