Is it possible to pipe to console.log?

console.log is just a function that pipes the process stream to an output.

Note that the following is example code

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

Piping to process.stdout does exactly the same thing.

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

Note you can also do

process.stdout.write(response);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)