scriptonist
scriptonist

Reputation: 807

Generate cURL string representation from libcurl instance

I was wondering if it is possible to generate cURL string from a libcurl instance. For example if I'm using the node binding for libcurl as below,

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

Upvotes: 1

Views: 129

Answers (1)

jonathancardoso
jonathancardoso

Reputation: 12707

This is not possible with libcurl and so it's not possible with the Node.js bindings, 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.

disclaimer: I'm the author of the node.js bindings

Upvotes: 0

Related Questions