const readline = require('readline') const rl = readline.createInterface({ input: process.stdin, terminal: false }) lines = [] rl.on('line', (line) => { lines.push(line) }) rl.on('close', () => { console.log(lines) })