Last active
May 14, 2016 05:37
-
-
Save cpuspellcaster/940f4a50f4261debd0c671e1d8207bb7 to your computer and use it in GitHub Desktop.
For those times when you need to promise but you want to stream: https://jsla.slack.com/archives/general/p1463179910000661
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
| function streamToPromise (stream) { | |
| return new Promise((resolve, reject) => { | |
| stream.on('end', resolve) | |
| stream.on('error', reject) | |
| }) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment