3 ms·
Use Stream.finished. $ node -e "const { Stream } = require('stream'); s = process.stdout; s.write('@'.repeat(128 * 1024)); Stream.finished(s, () => { proce
by 3np 2y ago
Use Stream.finished.
$ 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-options-callback https://nodejs.org/api/stream.html#streamfinishedstream-opti...