diff --git a/doc/api/process.md b/doc/api/process.md index 818bb6ed4ab73c..28ed9734f55144 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1856,8 +1856,9 @@ a [Readable][] stream. process.stdin.setEncoding('utf8'); process.stdin.on('readable', () => { - const chunk = process.stdin.read(); - if (chunk !== null) { + let chunk; + // Use a loop to make sure we read all available data. + while ((chunk = process.stdin.read()) !== null) { process.stdout.write(`data: ${chunk}`); } });