mini-effect
    Preparing search index...

    Function formData

    • Reads the response body as FormData.

      Parameters

      • response: Response

        The Response whose body to read

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

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

      Wraps Response.formData() 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, formData } from "mini-effect/fetch";

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