I tried to point someone to this repo who was asking a question about an easier replacement for XHR+FileSystem for File Downloads, but there seems not be an example for this use case specifically.
I don't have a download example readily available that we can use here, but I would merge a pull request if someone else has an example.
+1
voil脿!!!
fetch(url_to_file, {
method : 'GET'
})
.then(result => result.blob())
.then(result => {
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
var blob = new Blob([result], {type: "application/pdf"});
var url = window.URL.createObjectURL(blob);
a.href = url;
a.download = "filename_here.pdf";
a.click();
window.URL.revokeObjectURL(url);
}
)
Most helpful comment
+1