I’d like ANSI C style stdout operations on stdout.
That is, I’d like to be able to treat a file descriptor and stdout in exactly the same way.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One can use
fs.readto read from a file descriptor andfs.writeto write to a file descriptor.Since
process.stdoutis a Stream it has a propertyfdwhich refers to the file descriptor.fs.write(process.stdout.fd, new Buffer("hello world"), 0, 11, 0)Note that the
fdproperty is undocumented and might disappear in later versions of node.Since this isn’t documented anywhere you basically have to read the source