I have this code:
function saveFile(str, part) {
var textFileAsBlob = new Blob([str], {type:"text/plain"});
var fileNameToSaveAs = "Parsed audio - part "+part;
var downloadLink = document.createElement("a");
downloadLink.download = fileNameToSaveAs;
downloadLink.innerHTML = "Download File";
if (window.URL != null)
{
// Chrome allows the link to be clicked
// without actually adding it to the DOM.
downloadLink.href = window.URL.createObjectURL(textFileAsBlob);
}
downloadLink.click();
}
It works okay, except this one problem with Chrome: The blob's "footprint" or whatever is kept in Chrome's main process' memory. When download window is opened, the whole blob (250MB in my case!) is copied into main process' memory. That's kinda bad since if I save multiple files, I eventually fill memory up to 750MB, and at that point chrome stops downloading files with "Not found" error. Pic: https://i.stack.imgur.com/j5PUn.jpg
Am I doing some stupid mistake or is this Chrome's fault? Can I clean Chrome's memory to get rid of this problem?