Guest User

Untitled

a guest
Nov 22nd, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. // the old way
  2.  
  3. const cp = require('child_process');
  4. const k = cp.spawn('npm', ['install','lodash']);
  5. k.stdout.on('data', yourHandlerHere);
  6.  
  7. // the more generic way
  8.  
  9. const cp = require('child_process');
  10. const k = cp.spawn('bash');
  11. k.stdout.on('data', yourHandlerHere);
  12. k.stdin.write('npm install lodash');
  13. k.stdin.end('\n');
Add Comment
Please, Sign In to add comment