Node.js API
const { launch, BrimpError } = require('@brimp/brimp')The Node binding is an asynchronous, in-process native addon.
launch()
Section titled “launch()”launch(options?: { personaJson?: string }): Promise<Browser>Creates a browser backed by the shared runtime. personaJson is JSON text using
Brimp’s versioned persona schema.
Browser
Section titled “Browser”browser.newPage()
Section titled “browser.newPage()”newPage(): Promise<Page>Creates an about:blank page with its own owner thread.
browser.close()
Section titled “browser.close()”close(): Promise<void>Closes child pages and then the browser. Closing more than once is safe.
page.goto()
Section titled “page.goto()”goto( url: string, options?: { timeoutMs?: number; signal?: AbortSignal },): Promise<void>Navigates the page. The default timeout is 30,000 milliseconds. Aborting the signal cancels the core operation and its network request.
page.evaluate()
Section titled “page.evaluate()”evaluate(expression: string): Promise<unknown>Evaluates JavaScript and returns a JSON-compatible value.
Document output
Section titled “Document output”title(): Promise<string>textContent(): Promise<string>title() returns the current document title. textContent() returns the
canonical document text output.
page.screenshot()
Section titled “page.screenshot()”screenshot(options?: { fullPage?: boolean }): Promise<Buffer>Returns a PNG Buffer for the viewport or full page.
page.close()
Section titled “page.close()”close(): Promise<void>Closes page resources. Closing more than once is safe.
Errors
Section titled “Errors”Operations reject with BrimpError. Its code is one of:
invalid_input transport http_status navigation javascripttimeout cancelled unsupported closed screenshot internalCurrent boundary
Section titled “Current boundary”The native Node API does not expose locators, browser modes, raw CDP dispatch,
or a request/response object. Use brimp cdp when the supported
Puppeteer interface is the better fit.