Skip to content

fetchPage

function fetchPage(url: string, options?: GuardedFetchOptions): Promise<string>;

Fetch a page and return its text, with the honest bot User-Agent, the SSRF guard, the deadline, and the size cap. Throws on a non-200.

A cap rejection throws an error isTooLargeError recognizes, so a caller can treat it as permanent rather than retry it forever.

ParameterTypeDescription
urlstringThe address to fetch.
optionsGuardedFetchOptionsCap, headers, fetch, and timeout overrides.

Promise<string>

The decoded body.