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

前端 未结 5 557
走了就别回头了
走了就别回头了 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条回答
  •  Happy的楠姐
    2021-01-18 01:11

    Don't.

    What you want to do is pause() your input when the output is full, like the pump() method does, then resume() it when you've got space to write. If not, your process balloons out to gargantuan size.

    You probably want to use the more direct outputStream stuff for that, though, or the write() call, not console.log().

提交回复
热议问题