Hi I am trying to download tests report (generated by the backend – py4web framework) as an HTML file. My issue here is when I click on the download button, the browser pop up with save and open options is not shown until the whole file is downloaded to the browser. Some times this files size is reaching 30 MB or more and nothing happens until this 30 MB is downloaded. I want to have the download pop up open the moment user clicks on the download button and the progress should be shown as the file is being downloaded. Below is my code.
axios.get(url).then(res => {
var data = res.data.content;
var filename = res.data.filename;
var htmlFile = new Blob([data], {type:”text/html”});
var link = document.createElement(“a”);
link.href = window.URL.createObjectURL(data);
link.download = filename;
link.style.display = “None”;
document.appendChild(link);
link.click();
})