node.js - Is it possible to pipe to console.log? -



node.js - Is it possible to pipe to console.log? -

i trying larn node.js.

i trying understand streams , piping.

is possible pipe response of http request console.log?

i know how binding handler info event more interested in streaming console.

http.get(url, function(response) { response.pipe(console.log); response.on('end', function() { console.log('finished'); }); });

thanks

console.log function pipes process stream output.

note next illustration code

console.log = function(d) { process.stdout.write(d + '\n'); };

piping process.stdout same thing.

http.get(url, function(response) { response.pipe(process.stdout); response.on('end', function() { console.log('finished'); }); });

note can do

process.stdout.write(response);

node.js stream

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -