exec shell command nodejs code example
Example: node execute shell commands
const { exec } = require("child_process");
exec("cat index.js", (error, data, getter) => {
if(error){
console.log("error",error.message);
return;
}
if(getter){
console.log("data",data);
return;
}
console.log("data",data);
});