Skip to content

Instantly share code, notes, and snippets.

@omar-dulaimi
Created January 1, 2023 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omar-dulaimi/cff5a728994fc0f0bc9b1a0c1c230a79 to your computer and use it in GitHub Desktop.
Save omar-dulaimi/cff5a728994fc0f0bc9b1a0c1c230a79 to your computer and use it in GitHub Desktop.
How to use Buffers/Bytes with tRPC and Prisma
superjson.registerCustom<Buffer, number[]>(
{
isApplicable: (v): v is Buffer => v instanceof Buffer,
serialize: v => [...v],
deserialize: v => Buffer.from(v)
},
"buffer"
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment