link is created here with createElement. For this anchor tag, visibility is hidden, download is set to filename and blob from earlier is convert to blobUrl and href is set to blobUrl
document.body.appendChild(link);link.click();document.body.removeChild(link);// As per documentation, call URL.revokeObjectURL to remove the blob from memory.setTimeout(() => { URL.revokeObjectURL(blobUrl);});
Here, link is appended to the document.body and link is clicked so as to download the file. As part of cleanup, first the link is removed from the DOM and URL.revokeObjectURL is called with blobUrl
As per documentation, call URL.revokeObjectURL to remove the blob from memory.
I guess, it is important to remove the blob from the memory.
Hey, my name is Ramu Narasinga. I study large open-source projects and create content about their codebase architecture and best practices, sharing it through articles, videos.