T
tRPC

❓-help

Transferring huge buffer

HHaaxor168912/10/2023
I'm using tRPC with superjson serializer in an Electron app. I have a router querry that loads an png image, parses it with sharp and sends it as a buffer to client to render inside canvas. For larger files (62MB) I'm getting a Invalid array length error from superjson though. Can you think of a way to work around this issue?
Solution:
I've implemented it by returning the url to fetch from my mutation and added ``ts protocol.handle('local-raw', request => net.fetch(file:///${request.url.slice('local-raw://'.length)}`) );...
Jump to solution
SSebasPtsch12/10/2023
are you sending the buffer or encoding it in some way? as a int8array or uint8clampedarray?
HHaaxor168912/10/2023
int8array
Solution
HHaaxor168912/10/2023
I've implemented it by returning the url to fetch from my mutation and added
protocol.handle('local-raw', request =>
net.fetch(`file:///${request.url.slice('local-raw://'.length)}`)
);
protocol.handle('local-raw', request =>
net.fetch(`file:///${request.url.slice('local-raw://'.length)}`)
);
to app.whenReady so the buffer doesn't have to go through tRPC

Looking for more? Join the community!

Recommended Posts
Report progress of mutationI'm using tRPC in a electron app and am running a nodeWorker from main thread. Is there a way to repDiscriminated output based on discrimiated inputI have this function which works correctly by itself, but when i put it on trpc, the output doesn't How to create a React Component that fetch API based on a router from props ?I want to pass in my React component props the name of the router to use, here is my current implemeHow to pass through authentication header when using createTRPCProxyClient and RSC?Hi - we are having a great time with tRPC, and have it working well in a Next14 + React Server CompoIntegrating tRPC with Clerk Authentication in an Existing Next.js "Turborepo" ProjectHello, I am currently working on a Next.js application within a Turborepo setup and am looking to inHelp understanding how to deploy tRPC in monorepo.Hi All, I read in the FAQ that most benefits come from using tRPC in a monorepo. So if i want to buibest way to delete trpc?I want to delete TRPC from a Nextjs project. What is the most appropiate way to take it out? ThanksQuery string paramsHi , new to tRPC, is there a way to send query string params with tRPC when making a request ?Error running dist/client/index.jsGot this error during node dist/client/index.js I have ran tsc -b also followed as same as in docsTRPC, Cookies, fetchI try to cakl my backend inside trpc procedures and I an using fetch for this. Is it possible so tha`The property 'query' in your router collides with a built-in method`I'm seeing an error (attached) where I can get autocompletes on TRPC in the file where the client isUsing trpc backend across multiple seperate front endsI want to create a nodejs backend with trpc to expose some api endpoints. This will then be called aHow can I Prefetch on client or server component on App router Nextjs?how can I pretch data on app router nextjsPage couldn't be rendered statically because it used `cookies`Has anyone had this issue? I'm using trpc in a server component and in localhost it works fine but i