Skip to content

Instantly share code, notes, and snippets.

@radvieira
Last active December 12, 2015 05:18
Show Gist options
  • Save radvieira/4720112 to your computer and use it in GitHub Desktop.
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.
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