[英]Generate cURL string representation from libcurl instance
I was wondering if it is possible to generate cURL
string from a libcurl instance.我想知道是否可以从 libcurl 实例生成
cURL
字符串。 For example if I'm using the node binding for libcurl as below,例如,如果我正在使用 libcurl 的节点绑定,如下所示,
const curl = new Curl();
curl.setOpt(Curl.option.URL, "https://httpbin.org/get");
Is it possible to somehow generate the following from this instance?是否有可能从这个实例中生成以下内容?
curl https://httpbin.org/get
This is not possible with libcurl
and so it's not possible with the Node.js bindings, node-libcurl
.这对于
libcurl
是不可能的,因此对于 Node.js 绑定node-libcurl
是不可能的。
To do that you will need to create a wrapper around the Curl
instance and keep track of the options being set on it, you can then use that information to build the command line arguments.为此,您需要围绕
Curl
实例创建一个包装器并跟踪在其上设置的选项,然后您可以使用该信息来构建命令行 arguments。
disclaimer: I'm the author of the node.js bindings免责声明:我是 node.js 绑定的作者
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.