Skip to content

Instantly share code, notes, and snippets.

@Christilut
Created April 10, 2019 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Christilut/09ed80b6250eb8f5585083d498329cb8 to your computer and use it in GitHub Desktop.
Save Christilut/09ed80b6250eb8f5585083d498329cb8 to your computer and use it in GitHub Desktop.
download file from string
export function download (data: any, filename: string) {
const url = window.URL.createObjectURL(new Blob([data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', filename)
document.body.appendChild(link)
link.click()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment