Node.js, stdout, and disappearing bytes
01-Nov-2024 116
Someone in one of my online communities recently asked about why their Node command was dropping output when piped to another command:
[command] spits out 2319 lines of valid json to stdout. If I redirect it into a file then I can open that file and yes, see all 2319 lines and well formatted json.
But when I pipe it to jq, it complains that the json terminates on line 1394
If I pipe to wc then it reports there are 1394 lines
If I pipe to tee to write it to a file and then pipe that to wc it reports 1394 and the file indeed cuts off my json part way through the 1394th line
There is nothing unusual about this line
What could be going on?.
Node.js, stdout, and disappearing bytes #js #javascript #Node.js, #stdout, #disappearing #bytes https://www.javascript.ba/link/node-js-stdout-and-disappearing-bytes