Simple example:
node someCode.js|grep "someString"
Displays someString as it is written out.
Now
node someCode.js|grep "someString" > /tmp/someFile &
In another window:
ls -l /tmp/someFile
shows 0 bytes... so I cannot cat it to see its content. I know that process.stdout.write is a stream that is flushed immediately upon write...
What do I need to do to get the output file updated with content as it is written out? There are complicated ways like writing to UNIX sockets and creating a custom UNIX-socket based cat-like program but thats too heavy for this simple requirement.