Programming

Read All Lines from Stdin Using Node JS Split Module

First:

npm install split

Then your JavaScript code:

process.stdin.setEncoding('utf8');
process.stdin.pipe(split())
  .on('data', (line) => {
    console.log('GOT '+line);
  })
  .on('end', () => {
    console.log("Starting up server");
  });
Archive