Last active
June 23, 2020 21:11
-
-
Save sploders101/597b98abe2aff7d7f5055f95f7e3cd62 to your computer and use it in GitHub Desktop.
Simple function for downloading text
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
function downloadString(str, name) { | |
const elem = document.createElement("a"); | |
elem.href = URL.createObjectURL(new Blob([str])); | |
elem.download = name; | |
elem.click(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment