$ node -e "const { Stream } = require('stream'); s = process.stdout; s.write('@'.repeat(128 * 1024)); Stream.finished(s, () => { process.exit(0); })" | wc -c
131072
https://nodejs.org/api/stream.html#streamfinishedstream-opti... $ node -e "fs.writeFileSync(1, Buffer.from('@'.repeat(128 * 1024))); process.exit(0);" | wc -c
131072(If blocking the process on writing synchronously to stdout is indeed what you actually want...)