Skip to main content
100%

Node command line read from input (hope I get this working)

✓ Published0🌍 Public
Aalessioalex
Last edited Nov 29, 2011
Created on Nov 29, 2011

This example demonstrates a minimal interactive command-line interface in Node.js. It reads user input from standard input, echoes the entered text with a prompt prefix, and terminates when the user types “exit”. The code uses `process.openStdin()` to access the input stream, sets its encoding to UTF-8, and registers a data event handler via `stdin.on('data', ...)` to process each line of input. No external libraries are required; it relies solely on Node.js built-in process and stream APIs.

AI-generated description

Similar vizzes