Fitim BytyqiF
tRPC15mo ago
10 replies
Fitim Bytyqi

Blob as response

I know this has been mentioned couple of time but does TRPC allow returning a blob on the client from a publicProcedure.

downloadFile: baseProcedure.mutation(async () => {
    const response = await ky("api/export", {
      headers: {
        Authorization: `Bearer ${(await cookies()).get("token")?.value}`,
      },
    }).blob();

    return response;
  }),


This works when used with server actions from this blog https://trpc.io/blog/trpc-actions

I wanted to ask if that's the case with publicProcedures too.
Was this page helpful?