Skip to content

getFetch()

@blobs/sdk v0.1.0


@blobs/sdk / utils/environment / getFetch

getFetch(): {(input, init?): Promise<Response>; (input, init?): Promise<Response>; }

Defined in: utils/environment.ts:96

Resolve a fetch implementation for the current runtime.

In the browser returns window.fetch. In Node.js returns global.fetch (Node 18+) or throws if no fetch is available.

Returns

A fetch-compatible function.

(input, init?): Promise<Response>

MDN Reference

Parameters

input

URL | RequestInfo

init?

RequestInit

Returns

Promise<Response>

(input, init?): Promise<Response>

MDN Reference

Parameters

input

string | URL | Request

init?

RequestInit

Returns

Promise<Response>

Throws

If the environment doesn’t expose a usable fetch.