Open CanadaHonk opened 3 weeks ago
I'm curious how you are using process.stdout.read()
?
@CanadaHonk What is the use case for process.stdout.read
?
I didn't find a single example of process.stdout.read()
being used in Node.js documenta, and no examples in the wild.
process.stdout.read()
appears to be just a useless Node.js function.
I asked on Reddit. Nobody could articulate a use or use case for process.stdout.read()
.
This is the answer from Reddit that makes the most sense, to me.
What are the use cases for Node.js' process.stdout.read()?
process.stdout
functions by automatically outputting what was written to it, without being read. It cannot be read. It's writable only.It has the
.read()
method on it, because it inherits it from theEventEmitter
class (which theStream
class extends), and is part of the whole stream API.But it's vestigial. It doesn't actually work. It's just there as a consequence of inheritance, and nothing more. Nobody is using
process.stdout.read()
in code, because it's not a readable stream. You can't read from it.That's your answer. You CANNOT read from
stdout
. Theread()
method is an artifact.
If anybody can contest the above conclusion that Node.js process.stdout.read()
is a useless Node.js artifact, kindly share reproducible code here where process.stdout.read()
is used. Thanks.
What version of Bun is running?
1.1.32+fe8d0079e
What platform is your computer?
Linux 6.11.3-200.fc40.x86_64 x86_64 unknown
What steps can reproduce the bug?
What is the expected behavior?
function
What do you see instead?
undefined
Additional information
No response