fork download
  1. process.stdin.resume();
  2. process.stdin.setEncoding('utf8');
  3.  
  4. var remainder = ''
  5. process.stdin.on('data', function (chunk) {
  6. console.log(chunk)
  7. console.log("sddefef")
  8. var lines = chunk.toString().split('\n');
  9. console.log(lines)
  10. lines.unshift(remainder + lines.shift());
  11. remainder = lines.pop();
  12. lines.forEach(function(line) {
  13. if (line === '42') {
  14. process.exit();
  15. }
  16. process.stdout.write(line+'\n');
  17. });
  18. });
Success #stdin #stdout 0.07s 36164KB
stdin
1
2
10
42
11
stdout
1
2
10
42
11

sddefef
[ '1', '2', '10', '42', '11', '' ]
1
2
10