Skip to content

doc: outline that process.stdin emits multiple readable events

Rodrigo Muino Tomonari requested to merge github/fork/anentropic/stdin-docs into master

I commented here: https://github.com/nodejs/node/issues/20503#issuecomment-480630773

Basically I found the current docs quite unclear about the behaviour of process.stdin, particularly with regards to reading a large file from stdin.

@mcollina suggested making a PR to improve the docs, so here is my attempt.

I have adjusted the code comments in the existing js example (as I found them misleading for my purposes). I have added a new paragraph, derived from @mcollina 's comment here https://github.com/nodejs/node/issues/20503#issuecomment-451730273 to try to explain the actual behaviour. Finally I have added a second code example reflecting what I think is a more typical use case.

Please review these carefully for terminology and accuracy, I don't have much experience with node.js

Checklist

Merge request reports

Loading