[英]How to execute curl commands from node js
My curl command sends XML data from XML file and the response is written in the specified path.我的 curl 命令从 XML 文件发送 XML 数据,响应写入指定路径。 My question is how to make this happen in node js.
我的问题是如何在节点 js 中实现这一点。
cd C:/test/ && curl localhost:9001 --data @ C:/test/Basic/SPND.xml -o C:/test/Basic/Result.xml';
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}`);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.