Node for input/output example

less than 1 minute read

Example of getting input and output from system in Node

1
2
3
4
5
6
7
8
9
10
11
import readline from 'node:readline'

const rl = readline.createInterface({
  input: process.input,
  output: process.output
})

rl.question('$ ', async (input) => {
  console.log(input);

})