create csv on the backend and server for download

I have a table called pollResults. It contains data that my users want to download into a csv file. What is the best way to generate that file on the backend (using t3 stack) and then serve it as a download on the client? ideally without getting anything like S3 involved.
7 Replies
Neto
Neto•15mo ago
How big is the file? You can just send the json data to the frontend and save to CSV there
danmrkw
danmrkw•15mo ago
thanks for the reply. it's up to 2000 rows so I'll give that a try.
Neto
Neto•15mo ago
If the file contents won't update that often You can store in S3 and just send a public link
danmrkw
danmrkw•15mo ago
the problem is this is sensitive data. so the download link should only be accessible to that user. and it should destroy in s3 once it is downloaded and yeah it updates regularly so I'd have to put it into s3 on click
Neto
Neto•15mo ago
You can check if only sending json is good enough for that case
danmrkw
danmrkw•15mo ago
I am considering offering the option to use the microsoft 365 API to write directly into that users OneDrive or reading that api doc maybe Google Drive... 😄
Neto
Neto•15mo ago
if works for you
Want results from more Discord servers?
Add your server
More Posts
is it "ideal" to directly fetch /api/trpc/route.procedure in another serverim wanting to use my create-t3-app app as main source of data for a different server, and for this ihow to store actually boolean in mysql instead 0 and 1Please, is there any way to enforce Boolean to be stored as true and false, not 0 and 1 in mysql IAny good practices for creating trpc queries/mutes that don't use Prisma, in a t3 app that does.From my understanding adding Prisma to the context of a router at it's base (createTRPCContext), resType for request and response. Should they be shared?Let's say I have 2 apis - getTask and createTask For createTask I need the request to be of the typHow do you initialize/seed your DB with/for static values? (e.g. post categories)Imagine you'd need to put some static values in the DB, for example **post categories**. Each categoIs there a way to make Typescript smarter when implementing a class?```typescript class AbstractClass { testMethod: (a: string, b: number) => Promise<boolean> tcreate-t3-app Dockerizing base install fails with Prisma?I am trying to learn and understand how to do things with Docker, and I saw a Deployment part of theHow to store session in DB using credentials provider?How to store session in DB using credentials provider? Otherwise, I cannot manage the user's logout mutate return valueSo I am not getting all of the data on my mutate return. I am creating a task, which has subtasks (rDisplay modal on back button clickHey all, I've received a task wherein we're displaying a modal on an order form when the user takes