Problem: When trying to download large files from backend all requests that come afterwards are in pending status until download is done / canceled. This issue persist in same browser window, if I open another browser or same one in incognito I can navigate through UI without any issue (indicating that backend is blocked and can response to new requests)
Using Express and React, from backend perspective I’m using streams (GET
endpoint), here is code snippet:
res.writeHead(200, {
'Content-Disposition': `attachment; filename=${encodedFileName}`,
});
stream.pipe(res);
On the frontend side I tried couple of things.
- Using
<a href="API_URL/download/id" />
- Using web workers
- Using package
streamsaver
But seems like issue is persistent on each solution I have tried.
Kevin Bogdan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.