Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If passing a file writable stream to the Console constructor in Node.js, is writing to it asynchronous?

Tags:

I've read the docs about the Console object and A note on process I/O, but can't figure out if the following would result in a synchronous or asynchronous operation:

const out = fs.createWriteStream('./out.log')
const logger = new Console(out)

logger.log('foo')

I'm curious about how this acts, especially on a *Nix system. But I wouldn't expect this to act differently on a Windows. The reason I am asking is because I had built a logger which leveraged the Console object, but I don't want the logger to be blocking when writing logs to files while in production.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!