cURL logo

The cURL module ports libcurl to JavaScript. libcurl is a free and easy-to-use client-side URL transfer library, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE. libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, Kerberos4), file transfer resume, http proxy tunneling and more!

Setting Options

There are 3 ways in JavaScript to set cURL options.

Use setopt

With setopt options are set as in the C/C++ version. All options are defined in the curl.Option object.

    var c = new curl.Easy();
    c.setopt(curl.Option.VERBOSE, true);
    c.setopt(curl.Option.URL, "");

Use setopt with an object

An object can be used. Use the constanst as array index for the option. This can be handy, when you want to use a separate script for setting the options (a configuration script for example) or to store the options in JSON format.

    var options = new Object();
    options[curl.Option.VERBOSE] = true;
    options[curl.Option.URL] = "";   
    var c = new curl.Easy();

Use properties

All options are also properties of Easy.

    var c = new curl.Easy();
    c.url = "";
    c.verbose = true;

Design downloaded from Free website templates, layouts, and tools.