Created
August 30, 2021 20:25
-
-
Save gustavoguichard/a72d253cb733fb41b53b86ba70318dc0 to your computer and use it in GitHub Desktop.
Show body data in pieces
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
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