Guest User

Untitled

a guest
Apr 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. const {spawn} = require('child_process');
  2. const readline = require('readline');
  3.  
  4.  
  5.  
  6. const ls = spawn('ls', ['-lh', '/usr']);
  7.  
  8. const rl = readline.createInterface({
  9. input: ls.stdout
  10. });
  11.  
  12. rl.on('line', (line) => {
  13. console.log(line);
  14. });
  15.  
  16. ls.on('close', (code) => {
  17. console.log(`code: ${code}`);
  18. });
Add Comment
Please, Sign In to add comment