Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
async download(image: string) {
const result = await fetch(`data:image/png;base64,${image}`);
const blob = await result.blob();
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = name;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.