Can Node.js run scripts on the server?

Can Node.js run scripts on the server on which it is installed? Scripts like bash scripts or PHP scripts, for example, for resizing images?

If so, how is it? Can you point me to the documentation page, please?

Thanks
Dan

+3
source share
1 answer

Yes it is possible. The following are demos:

You can also perform tasks such as non-resident child processes and clustering.

Running the unix command:

var exec = require('child_process').exec;
child = exec("something", function (error, stdout, stderr) {
  sys.print('stdout: ' + stdout);
  sys.print('stderr: ' + stderr);
  if (error !== null) {
    console.log('exec error: ' + error);
  }
});

See Node.js Documentation for more: http://nodejs.org/api/child_process.html

+4
source

All Articles