browser.ts
3 documented symbols. Read the signatures first, then expand each item for parameters, return types, and examples.
3
symbols
1
functions
1
interfaces
1
modules
1
members
1
returns
Reference
modulebrowserChromium browser session with automatic cleanup via Explicit Resource Management. Usage: await using session = await op…
Chromium browser session with automatic cleanup via Explicit Resource Management.
Usage: await using session = await openBrowser(); const png = await session.renderPage(html, 1200, 630); // browser.close() is called automatically when session goes out of scope
interfaceOgBrowserSession extends AsyncDisposableA browser session that can render HTML pages to PNG. Implements AsyncDisposable…
A browser session that can render HTML pages to PNG. Implements AsyncDisposable for automatic cleanup via await using.
Signature
export interface OgBrowserSession extends AsyncDisposable
Members
Methods
renderPage()
renderPage(html: string, width: number, height: number, publicDir?: string): Promise<Buffer>;
Parameters
htmlwidthheightpublicDiroptional
Returns
Promise<Buffer>
fnopenBrowser(): Promise<OgBrowserSession | null>Opens a Chromium browser and returns a session for rendering OG images. Returns…
Opens a Chromium browser and returns a session for rendering OG images. Returns null if Playwright/Chromium is not available.
The session implements AsyncDisposable — use await using for automatic cleanup:
await using session = await openBrowser();
if (!session) return;
const png = await session.renderPage(html, 1200, 630);
Signature
export async function openBrowser(): Promise<OgBrowserSession | null>
Returns
Promise<OgBrowserSession | null>