Skip to content

Instantly share code, notes, and snippets.

@leemartin
Created January 29, 2025 16:12
Show Gist options
  • Save leemartin/4734e5d350ae198ee3e6098f16577b84 to your computer and use it in GitHub Desktop.
Save leemartin/4734e5d350ae198ee3e6098f16577b84 to your computer and use it in GitHub Desktop.
Download blob util for Vue written in Typescript
export default function (blob: Blob, name: string) {
// Create object url
let data = window.URL.createObjectURL(blob)
// Create a element
let link = document.createElement('a')
// Add properties
link.href = data
link.download = name
// Click
link.click()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment