use c++ instead of c++0x to compatible with old compiler
This commit is contained in:
parent
f8f934a119
commit
314d43203f
11 changed files with 454 additions and 106 deletions
102
README.md
102
README.md
|
@ -1,36 +1,88 @@
|
|||
Node Curl Wrap
|
||||
Use select curl multi
|
||||
node-curl
|
||||
=========
|
||||
|
||||
node cURL wrapper, support all options and infos.
|
||||
|
||||
Quick Start
|
||||
===========
|
||||
-----------
|
||||
|
||||
curl = require('node-curl')
|
||||
curl('www.google.com', {VERBOSE: 1}, function(err, res) {
|
||||
console.info(res.status)
|
||||
console.info('-----')
|
||||
console.info(res.body)
|
||||
console.info('-----')
|
||||
console.info(res.info('SIZE_DOWNLOAD'))
|
||||
});
|
||||
* quick start
|
||||
|
||||
curl = require('node-curl');
|
||||
curl('www.google.com', function(err, res) {
|
||||
console.info(res.status);
|
||||
console.info('-----');
|
||||
console.info(res.body);
|
||||
console.info('-----');
|
||||
console.info(res.info('SIZE_DOWNLOAD'));
|
||||
res.close();
|
||||
});
|
||||
|
||||
|
||||
* with options
|
||||
|
||||
curl = require('node-curl')
|
||||
curl('www.google.com', {VERBOSE: 1, RAW: 1}, function(err, res) {
|
||||
console.info(res);
|
||||
res.close();
|
||||
});
|
||||
|
||||
Usage
|
||||
=====
|
||||
-----
|
||||
|
||||
Function: curl
|
||||
curl(url, [options = {}], callback)
|
||||
callback includes 2 parameters (error, result)
|
||||
* curl
|
||||
|
||||
Curl Options:
|
||||
options is on the list at http://curl.haxx.se/libcurl/c/curl_easy_setopt.html without CURLOPT_
|
||||
eg: CURLOPT_VERBOSE will be VERBOSE, CURLOPT_HEADER will be HEADER
|
||||
curl(url, [options = {}], callback)
|
||||
callback includes 2 parameters (error, result)
|
||||
|
||||
Object: result
|
||||
body
|
||||
status
|
||||
info
|
||||
* result in callback
|
||||
|
||||
Curl Infos:
|
||||
infos is on the list at http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html without CURLINFO_
|
||||
eg: CURLINFO_EFFECTIVE_URL will be EFFETCTIVE_URL
|
||||
members:
|
||||
status - Http Response code
|
||||
body - Http body
|
||||
|
||||
methods:
|
||||
info(name) - Get information of result, see 'info' section
|
||||
|
||||
Options
|
||||
-------
|
||||
* Any Curl Easy Options
|
||||
|
||||
eg: CURLOPT_VERBOSE will be VERBOSE, CURLOPT_HEADER will be HEADER
|
||||
|
||||
Full list at http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
|
||||
|
||||
* node-curl Extra Options
|
||||
|
||||
RAW - Returns Buffer instead of String in result.body
|
||||
|
||||
* About slist parameters
|
||||
|
||||
node-curl support slist which map to Javascript Array
|
||||
|
||||
eg:
|
||||
HTTP_HEADER: ['FOO', 'BAR']
|
||||
HTTP_HEADER: 'FOO'
|
||||
|
||||
any non-array parameter will convert to [ parameter.toString() ]
|
||||
|
||||
Infos
|
||||
-----
|
||||
* Any Curl Info options
|
||||
|
||||
eg: CURLINFO_EFFECTIVE_URL will be EFFETCTIVE_URL
|
||||
|
||||
full list at http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html
|
||||
|
||||
|
||||
* About slist
|
||||
|
||||
slist will be returns in Array
|
||||
eg: CURLINFO_COOKIELIST
|
||||
|
||||
|
||||
Hints
|
||||
-----
|
||||
close the result to release resource of curl immediately.
|
||||
|
||||
or the resource will not release until gc performed.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue