const { exec } = require('child_process');
const cmd = 'scp username@remoteip:remote_location_file /location/where/you/save'
const yourscript = exec(cmd,
(error, stdout, stderr) => {
if (error !== null) {
console.log(`exec error: ${error}`);
}
else if(stderr!==null){
console.log(`exec stderr :${stderr}`);
}else{
console.log(stdout.toString());
console.log("Success !!");
}
});
console.log(yourscript)