mini-effect
    Preparing search index...

    Function blob

    • Reads the response body as a Blob.

      Parameters

      • response: Response

        The Response whose body to read

      Returns Effect<Blob, Failure<"FailedToRead">, never, never>

      An Effect that resolves with a Blob or fails with a FailedToRead tagged error

      Wraps Response.blob() in an Effect. If reading fails, the error is wrapped in a FailedToRead tagged error that can be caught with catchTags.

      import { pipe, run } from "mini-effect";
      import { request, blob } from "mini-effect/fetch";

      const data = await run(
      pipe(request("https://example.com/image.png"), (res) => blob(res)),
      );