Created
March 13, 2014 19:36
-
-
Save evansolomon/9535323 to your computer and use it in GitHub Desktop.
Even when you don't care about a stream's data, you need to make sure it's produced.
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
var https = require('https') | |
https.get('https://medium.com', function (res) { | |
res.on('end', function () { | |
console.log('You will never see this') | |
}) | |
}) | |
https.get('https://medium.com', function (res) { | |
// This sets the stream to flowing mode and makes sure it gets through all of its | |
// data so that you get an end event. | |
res.on('data', function () {}) | |
res.on('end', function () { | |
console.log('You *will* see this') | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment