Fetch.functions.fetchBytes
Function: fetchBytes()
Section titled “Function: fetchBytes()”fetchBytes(
request):Effect<Uint8Array<ArrayBuffer>,MalformedBytesError|FetchError|AbortError|NotAllowedError|NotOkError,Fetch>
Defined in: packages/fx-fetch/src/Fetch/fetchBytes.ts:36
Fetches and reads a bytes response.
Parameters
Section titled “Parameters”request
Section titled “request”Returns
Section titled “Returns”Effect<Uint8Array<ArrayBuffer>, MalformedBytesError | FetchError | AbortError | NotAllowedError | NotOkError, Fetch>
0.1.0
Example
Section titled “Example”import { Effect } from 'effect';import { Fetch, Request, Response } from 'fx-fetch';
// ┌─── Effect.Effect<// │ void,// │ | Fetch.FetchError// │ | Fetch.AbortError// │ | Fetch.NotAllowedError// │ | Response.NotOkError// │ | MalformedBytesError,// │ Fetch.Fetch// │ >// ▼const program = Effect.gen(function* () { const request = Request.unsafeMake({ url: './my-endpoint' });
// ┌─── Uint8Array<ArrayBuffer> // ▼ const payload = yield* Fetch.fetchBytes(request);});