Skip to content

Function: fetch() ​

ts
function fetch(input, init?): Promise<Response>;

Defined in: types/desktop-engine.d.ts:4073

Fetches a URL or a package file. Resolves once the headers have arrived, also for 4xx / 5xx statuses, and the body follows as a stream. The download pauses while about 1 MB is waiting to be read. Rejects with a TypeError when the request can't be made (no network permission, unreachable host, ...).

Parameters ​

ParameterType
input| RequestInfo | URL | { toString: string; }
init?RequestInit

Returns ​

Promise<Response>

Remarks ​

The system buffers the first 512 bytes of a text/plain response (content sniffing) before it's delivered: streamed text, like server-sent events, should use another Content-Type such as text/event-stream.

The SDK is released under the Apache License 2.0