Skip to content

loadLogoDataUri

Rasterize an SVG favicon to a PNG data URI via resvg for embedding in the satori layout (satori’s <img> needs a raster/data-URI source). Returns null when the file is missing so the caller can render the card without a logo. Call this ONCE and reuse the result across all cards.

Import:

import { loadLogoDataUri } from '@mnaoumov/typescript-dev-toolkit/docs-site/og-image';

Signature:

function loadLogoDataUri(faviconPath: string): Promise<string | null>

Parameters:

Parameter Type Description
faviconPath string The SVG favicon’s path.

Returns: Promise<string | null> — The PNG data URI, or null when the favicon is missing.