I wrote a node JS script, that should execute using the PowerShell command line. And then return the PowerShell response to angularjs. The PowerShell command takes more than 5 minutes for execution. So node is sending an empty response to angularjs. For this, I tried the callback function. But I'm getting the same empty response. Please help me to solve this.
This is code for executing powershell using callback function in node js
let ps = new shell({
executionPolicy: 'Bypass',
noProfile: true
});
function getData(callback){
ps.addCommand('C:/Users/sowmi096/Desktop/Code/jobid.ps1',a)
ps.invoke()
.then(output => {
return callback(null,output);
})
.catch(err => {
return callback(null,err);
ps.dispose();
});
}
getData(function onGetData(err,data){
if(err)
res.send(err);
res.send(data);
});