bingcoke
bingcoke10mo ago

it sound like handle upload/download file need build new http server or endpoint?

I have scan all posts i can about solution for handle upload/download file with trpc.So there is no great solution for this with trpc for now? If no, i can only build new nestjs server to handle files specially but i need implement permission management again and can't reuse middleware that used in trpc. By the way, trpc is a Wonderful project for ts full stack developer!
Solution:
not sure what you're using for file storage. we use S3 Buckets on our project and we have our tRPC endpoitn generate a pre-signed URL for S3 Uploads that gets sent to the frontend, and the file is uploaded directly from client to S3 downloads work similarly where we can generate presigned url's if the bucket is not public, or just give them the public link if it is...
Jump to solution
3 Replies
Solution
haardik | LearnWeb3
not sure what you're using for file storage. we use S3 Buckets on our project and we have our tRPC endpoitn generate a pre-signed URL for S3 Uploads that gets sent to the frontend, and the file is uploaded directly from client to S3 downloads work similarly where we can generate presigned url's if the bucket is not public, or just give them the public link if it is
Aqeu
Aqeu10mo ago
Exactly what @haardik said, but if you're using Next you can make an Next api endpoint to upload your file and with the help of createcaller or on client, use trpc to save the url from that upload
bingcoke
bingcoke10mo ago
thanks bro!this is an excellent way i am creating a react native app so you know.but thanks for your suggestion,when i build a web application i will try it
More Posts