My curl command sends XML data from XML file and the response is written in the specified path. My question is how to make this happen in node js.
cd C:/test/ && curl localhost:9001 --data @ C:/test/Basic/SPND.xml -o C:/test/Basic/Result.xml';
CodePudding user response:
You can use something like this
const { exec } = require("child_process");
exec("ls -la", (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}
console.log(`stdout: ${stdout}`);
});