`process.stdout.write` is different to PHP's `echo` and Python's `print` in that it pushes a write to an event queue without waiting for the result which could result in filling event queue with writes. Instead, you can consider `await`-ing `write` so that it would write before pushing another `write` to an event queue.
node -e '
const stdoutWrite = util.promisify(process.stdout.write).bind(process.stdout);
(async () => {
while (true) {
await stdoutWrite("1");
}
})();
' | pv > /dev/null