Created
April 27, 2019 12:06
-
-
Save BasilArackal/2e775e960bfe7bc3fec366b8fab7f452 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
export const DOWNLOAD = (data, fileName) => { | |
const a = document.createElement("a"); | |
document.body.appendChild(a); | |
a.style = "display: none"; | |
const blob = new Blob([data], { type: "octet/stream" }); | |
a.href = window.URL.createObjectURL(blob); | |
a.download = fileName; | |
a.click(); | |
window.URL.revokeObjectURL(a.href); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment