Created
February 9, 2017 15:28
-
-
Save neovov/08189ebf6208de752a9e5ddf9e3059f2 to your computer and use it in GitHub Desktop.
ReadableStream piping
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
// Read a chunk | |
reader.read().then(function process(result) { | |
if (result.done) { | |
return controller.close(); | |
} | |
console.log('Reading', result.value.length, 'bytes'); | |
controller.enqueue(result.value); | |
return reader.read().then(process); // Continue reading | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment