Next.js Discord

Discord Forum

Download file from server action

Unanswered
Thai posted this in #help-forum
Open in Discord
Avatar
ThaiOP
I need to download a file from external API, and I find a lot of troubles trying to download the file using server actions, but for some reason i get the file corrupt when i try to open it.

2 Replies

Avatar
what does the server action in this case do? Download the file from somewhere directly? Fetch an url from the external api that points to the file? ...?
Avatar
ThaiOP
fetch an external api, and the api returns the file in the request

Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8