Skip to content

fetchBytes

function fetchBytes(url: string, options?: GuardedFetchOptions): Promise<Uint8Array<ArrayBufferLike>>;

Binary twin of fetchPage: same guard, User-Agent, deadline, and streamed size cap, but returns the raw bytes — for document downloads (PDFs, images, audio) where decoding to text would corrupt the payload.

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

Promise<Uint8Array<ArrayBufferLike>>

The body bytes, exactly as received.