Last active
December 12, 2015 05:18
-
-
Save radvieira/4720112 to your computer and use it in GitHub Desktop.
Here's how you can pipe request to a writablestream a successful response.
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
var stream = fs.createWriteStream(writeTo); | |
request(uri).on('response', function(response) { | |
if(response.statusCode === 200) { | |
this.pipe(stream); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment