@stanfordspezi/spezi-web-design-system
Version:
Stanford Biodesign Digital Health Spezi Web Design System
19 lines (18 loc) • 530 B
JavaScript
const y = (r, c) => {
const t = URL.createObjectURL(r), e = document.createElement("a");
e.href = t, e.download = c, e.click(), URL.revokeObjectURL(t);
}, h = (r, c = "", t = 512) => {
const e = atob(r), l = [];
for (let o = 0; o < e.length; o += t) {
const s = e.slice(o, o + t), a = new Array(s.length);
for (let n = 0; n < s.length; n++)
a[n] = s.charCodeAt(n);
const b = new Uint8Array(a);
l.push(b);
}
return new Blob(l, { type: c });
};
export {
h as base64ToBlob,
y as downloadFile
};