Created
July 17, 2018 07:48
-
-
Save nickbrowne/706e6225bdafbc730f6d469b80c5828a to your computer and use it in GitHub Desktop.
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
// this only half works, it's a demonstration of the idea | |
export default (text, filename) => { | |
const blob = new Blob([text], { type: "text/plain" }); | |
const anchor = document.createElement("a"); | |
anchor.download = filename; | |
anchor.href = window.URL.createObjectURL(blob); | |
anchor.target = "_blank"; | |
anchor.style.display = "button"; | |
return anchor; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment