#Write file to disk within route.ts file

2 messages · Page 1 of 1 (latest)

glacial aurora
#

Is it possible to stream a file to disk when submitted via a form (formData)?

Maybe I am missing something, but I see a limitation here. When you call await request.formData() it loads the file into memory.

What if my users upload a large file, and the server does not have enough memory to hold the file. I would like to write the file to disk so I can access it throughout the request lifecycle.

Imagine I am hosting my application on my own server, where I have 32GB of RAM, I upload a 50GB file, I need to store it on disk and not in memory. How can I do this?

barren oasisBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)