Created
June 8, 2017 18:07
-
-
Save ivoputzer/616ff3e1aa94d9b270202f1aea48f572 to your computer and use it in GitHub Desktop.
bufferFrom.js
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
function bufferFrom (stream, fn, {concat} = Buffer) { | |
return buffer = [] | |
, stream.on('data', (data) => buffer.push(data)) | |
.on('end', () => fn(concat(buffer))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment