I can’t believe I have to ask this, but here we are. This sounds like the most trivial of requirements, yet in seems mind bogglingly impossible, but I’m not a front end developer so I’m hopefully just missing something obvious.
I have an endpoint that serves a large binary. The browser should download it like normal. But, the endpoint is expecting an Authorization
header, as is normal these days.
My investigations revealed the following, equally unbelievably awful options:
- Change the server not to expect the
Authorization
and replace it with a cookie or something. This is a non starter for a thousand reasons, so lets just move on. - Abandon normal synchronous browser requests and use
fetch
or similar, and then buffer the gigantic file like a caveman who doesn’t understand that RAM and local storage are limited. - Reimplement half a browser inside a browser using something like native-file-system-adapter or StreamSaver which are intended for client side generated files, and have no business in a regular file download
Is that really it? Please tell me there actually is a sane way to just download a file in the year of our lord 2024…