Skip to content

Fetch.functions.fetchBlob

fx-fetch


fx-fetch / Fetch / fetchBlob

fetchBlob(request): Effect<Blob, MalformedBlobError | FetchError | AbortError | NotAllowedError | NotOkError, Fetch>

Defined in: packages/fx-fetch/src/Fetch/fetchBlob.ts:36

Fetches and reads a blob response.

Request

Effect<Blob, MalformedBlobError | FetchError | AbortError | NotAllowedError | NotOkError, Fetch>

0.1.0

Response.readBlob

import { Effect } from 'effect';
import { Fetch, Request, Response } from 'fx-fetch';
// ┌─── Effect.Effect<
// │ void,
// │ | Fetch.FetchError
// │ | Fetch.AbortError
// │ | Fetch.NotAllowedError
// │ | Response.NotOkError
// │ | MalformedBlobError,
// │ Fetch.Fetch
// │ >
// ▼
const program = Effect.gen(function* () {
const request = Request.unsafeMake({ url: './my-endpoint' });
// ┌─── Blob
// ▼
const payload = yield* Fetch.fetchBlob(request);
});