Created
August 13, 2019 19:59
-
-
Save zhouzi/ccdd390a8edcbffc3b57ecef0787b9e9 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
(async () => { | |
const response = await fetch('<url>', { | |
method: 'get', | |
headers: { | |
'Authorization': 'Bearer <token>' | |
} | |
}); | |
const blob = await response.blob(); | |
const url = URL.createObjectURL(blob); | |
const link = document.createElement('a'); | |
link.download = '<filename>'; | |
link.href = url; | |
link.click(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment