Last active
September 5, 2019 17:51
-
-
Save cmferreira-352/725b70fe3df153f19404c23e1b620d15 to your computer and use it in GitHub Desktop.
Trecho de código em js necessário para o download de algum objeto
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
var file = '{ "teste": "teste" }'; | |
var a = document.createElement("a"); | |
var blob = new Blob([file],{type:"application/json"}); | |
var url = URL.createObjectURL(blob); | |
a.href = url; | |
a.download = 'teste.json'; | |
document.body.appendChild(a); | |
a.click(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment