Download Files From Branch With Vanilla Javascript

I thought this would have been answered somewhere on the internet but the only thing that comes up is how to do it with GitHub. In my case, I want to use plain javascript to download a file from my public repo. This public repo is not visible to guests but it is public. I did an XHR request to see if I could download the raw file but everytime I do I recieve an HTML response and a 404 error message.
The URL I’m trying to access is

I guess my question is, can I do the same thing the Gitlab API can do with curl and GET but with XHR or plain javascript?