Skip to content

Instantly share code, notes, and snippets.

@gustavoguichard
Created August 30, 2021 20:25
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 gustavoguichard/a72d253cb733fb41b53b86ba70318dc0 to your computer and use it in GitHub Desktop.
Save gustavoguichard/a72d253cb733fb41b53b86ba70318dc0 to your computer and use it in GitHub Desktop.
Show body data in pieces
const res = await fetch('/')
const reader = res.body.getReader()
const data = await reader.read()
new TextDecoder().decode(data.value)
while(!data.done) {
console.log(new TextDecoder().decode(data.value))
data = await reader.read()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment