Need some advice on users downloading files from public folder

Is there a way that I can trigger a file to download from the public folder?

I have a button that goes and gets the file from another server and stores it in the downloaded folder.
Then I want that file to be downloaded to their pc.

I do not want to use:

 <a href="/download/lastest.rar" download target="_blank">Download</a>

I just want a line of code that will trigger it.
window.location.assign(fileLocation); gives me the error:

Not allowed to load local resource: file:///D:/Dev/Projects/Downloader/.meteor/.downloaded/Late%20For%20Work.mp3

I have also tried with the path and file being file:///D:/Dev/Projects/Downloader/public/.downloaded/Late%20For%20Work.mp3

1 Like