TonyTakeshi TonyTakeshi - 1 year ago 283
Node.js Question

Stdout flush for NodeJS?

Is there any stdout flush for nodejs just like python or other languages?

sys.stdout.write('some data')


Right now I only saw
for nodejs.

Answer Source

process.stdout is a WritableStream object, and the method WritableStream.write() automatically flushes the stream (unless it was explicitly corked). However, it will return true if the flush was successful, and false if the kernel buffer was full and it can't write yet. If you need to write several times in succession, you should handle the drain event.

See the documentation for write.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download