Created
January 29, 2025 16:12
-
-
Save leemartin/4734e5d350ae198ee3e6098f16577b84 to your computer and use it in GitHub Desktop.
Download blob util for Vue written in Typescript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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