Last active
May 26, 2019 23:24
-
-
Save adi518/883b7a3225380a9cfa39a5848c3c94c0 to your computer and use it in GitHub Desktop.
This file contains 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
const download = (fileName, data) => { | |
const blob = new Blob([data]); | |
const url = window.URL.createObjectURL(blob); | |
const a = document.createElement("a"); | |
a.href = url; | |
a.download = fileName; | |
a.style = "display: none"; | |
document.body.appendChild(a); | |
a.click(); | |
a.remove(); | |
window.URL.revokeObjectURL(url); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment