Based on no experience whatsoever, my suggestion would be to:
- Generate a unique url.
- Respond immediately with a screen notifying the user their file is being generated, with an estimate of the time it will take, and a refresh header that will connect to the unique url.
- Start a background process to create the file.
- When the refresh occurs, use the unique url to locate the file that you created and give the user a download link.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.