MOCKSTACKS
EN
Questions And Answers

More Tutorials









NodeJS code for STDIN and STDOUT without using any library


This is a simple program in node.js to which takes input from the user and prints it to the console.

The process object is a global that provides information about, and control over, the current Node.js process. As a global, it is always available to Node.js applications without using require().

Program


The process.stdin property returns a Readable stream equivalent to or associated with stdin.

The process.stdout property returns a Writable stream equivalent to or associated with stdout.

process.stdin.resume()
console.log('Enter the data to be displayed ');
process.stdin.on('data', function(data) { process.stdout.write(data) })


Conclusion

In this page (written and validated by ) you learned about NodeJS code for STDIN and STDOUT without using any library . What's Next? If you are interested in completing NodeJS tutorial, your next topic will be learning about: NodeJS MongoDB Integration for Express js.



Incorrect info or code snippet? We take very seriously the accuracy of the information provided on our website. We also make sure to test all snippets and examples provided for each section. If you find any incorrect information, please send us an email about the issue: mockstacks@gmail.com.


Share On:


Mockstacks was launched to help beginners learn programming languages; the site is optimized with no Ads as, Ads might slow down the performance. We also don't track any personal information; we also don't collect any kind of data unless the user provided us a corrected information. Almost all examples have been tested. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. By using Mockstacks.com, you agree to have read and accepted our terms of use, cookies and privacy policy.