Created
February 24, 2020 18:08
-
-
Save etienne-dldc/ec09393e53c36985b8c17cb113f98bf5 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 function fetchAsObjectURL(url) { | |
const response = await fetch(url); | |
const blob = await response.blob(); | |
return URL.createObjectURL(blob); | |
} | |
fetchAsObjectURL('https://jsonplaceholder.typicode.com/todos/1'); |
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
function *fetchAsObjectURL(url) { | |
const response = yield fetch(url); | |
const blob = yield response.blob(); | |
return URL.createObjectURL(blob); | |
} | |
runAsync(fetchAsObjectURL('https://jsonplaceholder.typicode.com/todos/1')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment