Skip to content

Instantly share code, notes, and snippets.

@justsml
Created November 16, 2018 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justsml/9bec219590ff50688972c1caff67c14b to your computer and use it in GitHub Desktop.
Save justsml/9bec219590ff50688972c1caff67c14b to your computer and use it in GitHub Desktop.
fetch examples:
// 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