Created
September 16, 2021 02:03
-
-
Save usayamadx/c76b6cd55bff968225cf1e029b79c1ed to your computer and use it in GitHub Desktop.
Response result, file download instead of console.log
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
let result = 'response json...' // api resonse ...etc | |
let domElement = document.createElement('a') | |
domElement.href = 'data:text/json,' + encodeURIComponent(JSON.stringify(result)) | |
domElement.target = '_blank' | |
domElement.download = 'response.json' | |
domElement.click() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment