Skip to content

Instantly share code, notes, and snippets.

@philipstanislaus
philipstanislaus / gist:c7de1f43b52531001412
Last active October 6, 2025 06:46
JavaScript: Save a blob to disc
var saveBlob = (function () {
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
return function (blob, fileName) {
var url = window.URL.createObjectURL(blob);
a.href = url;
a.download = fileName;
a.click();
window.URL.revokeObjectURL(url);