Skip to content
tRPC

Partners

Variable: octetInputParser

On this page

const octetInputParser: UtilityParser<OctetInput, ReadableStream>

Defined in: packages/server/src/unstable-core-do-not-import/http/contentTypeParsers.ts:39

An input validator for binary data, such as a File or Blob. The resolver gets the input as a ReadableStream.

Example

t.procedure.input(octetInputParser).mutation(async ({ input }) => {
  const bytes = await new Response(input).arrayBuffer();
  return { size: bytes.byteLength };
});

See

https://trpc.io/docs/server/non-json-content-types#file-and-other-binary-type-inputs