File uploads / downloads
https://github.com/trpc/examples-next-formdata I found this, does this mean it's possible to have file uploads and downloads with trpc now? Does it use chunking or does it put everything into memory.
GitHub
GitHub - trpc/examples-next-formdata
Contribute to trpc/examples-next-formdata development by creating an account on GitHub.
9 Replies
I will need to handle file sizes up to 10gb
cc @Shreyas
Non-JSON Content Types | tRPC
In addition to JSON-serializable data, tRPC can use FormData, File, and other Binary types as procedure inputs
However it's not appropriate to upload potentially large files this way, for that you should do it the "right" way, which means generating an upload link via a host like S3 and having the browser upload directly to it
You don't want one file upload overloading your server for all other users, and 10gb risks doing this
It may be fine for smaller projects though, just you could end up spending a lot more on hosting in network bandwidth and potentially RAM usage
This has to go directly to the file system
it's writing to the local file system inside of a docker container
Would it still be "fine" ?
Most likely fine if itβs a small use case
It's no different than implementing it myself with something like express, hono, elysia, right?
No different, exact same best practices apply
π thank you