I have a FastAPI endpoint that returns a zip file on calling it using text. I have a button on my page that says “Download file” and when the button is clicked, the API is called. I want the file returned by the endpoint to be automatically downloaded to the user’s computer. Any ideas on how I could do this?
Side note: I guess if this approach is a bit impractical, I could return a base64 response from my endpoint instead of a file and then convert that base64 string into a zip file and download that to the user’s computer. I’m open to suggestions from you guys. Thanks a lot.