/curljs

wraps curl functionality into an easy to use node.js module

Primary LanguageJavaScript

curljs

Wraps the functionality of curl into an easy to use node module

Note: requires curl installation

Installation

Install curl first

curljs uses curl so make sure you have it installed first

http://curl.haxx.se/docs/install.html

Install curljs

$ [sudo] npm install curljs

Usage

include the library in your node.js file

var curl = require("curljs");
var dataObject = {firstParam : "first value", secondParam : "second value"};
var curlOpts = curl.opts.silent()
                   .ignore_cert()
                   .follow_redirects()
                   .max_redirs(5)
                   .connect_timeout(3)
                   .post_data(dataObject);

curl("www.example.com", curlOpts, function(err, data, stderr) {
    // do something
}

Available Options

.verbose (boolean)
.follow_redirects (boolean)
.silent (boolean)
.ignore_cert (boolean)
.max_redirs (int)
.connect_timeout (int)
.ntlm (boolean)
.ntlm_proxy (boolean)
.post_data (object)
.post_data_urlencode (object)