photography of black dial telephone @gypsycompassrose

Using the exec command in node.js

Published: | Last Modified:

Using the exec command in Node.js is pretty simple, first import the exec function, and then call it with the the first argument being the command you are running, and the second argument a callback with params for error, stdout, stderr.

const exec = require('child_process').exec;

const command = `rsync -Pavu "/origin/${special}" "/destination/${show}/"`;

exec(command, function(err, stdout, stderr) {
    if (err) {

Feel free to make any fixes on GitHub