Created
November 16, 2018 23:23
-
-
Save justsml/9bec219590ff50688972c1caff67c14b to your computer and use it in GitHub Desktop.
fetch examples:
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
// The progressHelper could be inline w/ .then() below... | |
const streamProcessor = progressHelper(console.log) | |
fetch('https://fetch-progress.anthum.com/20kbps/images/sunrise-progressive.jpg') | |
.then(streamProcessor) // note: NO parentheses because `.then` needs to get a function | |
.then(response => response.blob()) | |
.then(blobData => { | |
// ... set as base64 on an <img src="base64..."> | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment