Skip to content

Instantly share code, notes, and snippets.

@talaikis
Created November 8, 2021 10:15
Show Gist options
  • Save talaikis/1fef7d2e4de64c0f9660311248b8afe9 to your computer and use it in GitHub Desktop.
Save talaikis/1fef7d2e4de64c0f9660311248b8afe9 to your computer and use it in GitHub Desktop.
import { saveAs } from 'file-saver'
const base64Data = ''
const imgBuff = Buffer.from(base64Data.replace(/^data:image\/\w+;base64,/, ''), 'base64')
const blob = new Blob([new Uint8Array(imgBuff).buffer])
saveAs(blob)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment