Created
May 5, 2020 04:53
-
-
Save afandiyusuf/12468986110ec4d8d41ca528ee5ee768 to your computer and use it in GitHub Desktop.
Download file from javascript
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 a = document.createElement('a'); | |
a.href = "data:application/octet-stream,"+encodeURIComponent([url_image_or_document]); | |
a.download = 'myFile.json';//filename | |
a.click(); | |
//source | |
//https://stackoverflow.com/questions/2897619/using-html5-javascript-to-generate-and-save-a-file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment