How can I write blocking in stdout with node.js?

前端 未结 5 502
走了就别回头了
走了就别回头了 2021-01-18 00:46

I\'m writing a node.js application which stdout is piped to a file. I\'m writing everything with console.log. After a while my Application reaches the 1GB Limit and stops. T

5条回答
  •  执笔经年
    2021-01-18 01:08

    Write using process.stdout.write, the return value is whether data got buffered. If it's true, continue writing when process.stdout emits the drain event.

    If you want your code to look sync, use streamlinejs as described here: Node.js stdout flush

提交回复
热议问题