Update README
This commit is contained in:
parent
91f39f4652
commit
648e170fa8
2 changed files with 5 additions and 2 deletions
|
@ -144,6 +144,8 @@ Example: examples/low-level.js
|
||||||
return chunk.length;
|
return chunk.length;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// curl.close() should be called in event 'error' and 'end' if the curl won't use any more.
|
||||||
|
// or the resource will not release until V8 garbage mark sweep.
|
||||||
curl.on('error', function(e) {
|
curl.on('error', function(e) {
|
||||||
p("error: " + e.message)
|
p("error: " + e.message)
|
||||||
curl.close();
|
curl.close();
|
||||||
|
@ -151,8 +153,8 @@ Example: examples/low-level.js
|
||||||
|
|
||||||
|
|
||||||
curl.on('end', function() {
|
curl.on('end', function() {
|
||||||
p('done.')
|
|
||||||
p('code: ' + curl.getinfo('RESPONSE_CODE'));
|
p('code: ' + curl.getinfo('RESPONSE_CODE'));
|
||||||
|
p('done.')
|
||||||
curl.close();
|
curl.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ if (!url)
|
||||||
|
|
||||||
curl.setopt('URL', url);
|
curl.setopt('URL', url);
|
||||||
curl.setopt('CONNECTTIMEOUT', 2);
|
curl.setopt('CONNECTTIMEOUT', 2);
|
||||||
|
curl.setopt('VERBOSE', 1);
|
||||||
|
|
||||||
// on 'data' must be returns chunk.length, or means interrupt the transfer
|
// on 'data' must be returns chunk.length, or means interrupt the transfer
|
||||||
curl.on('data', function(chunk) {
|
curl.on('data', function(chunk) {
|
||||||
|
@ -25,7 +26,7 @@ curl.on('error', function(e) {
|
||||||
|
|
||||||
|
|
||||||
curl.on('end', function() {
|
curl.on('end', function() {
|
||||||
curl.getinfo('RESPONSE_CODE');
|
p("code: " + curl.getinfo('RESPONSE_CODE'));
|
||||||
curl.close();
|
curl.close();
|
||||||
p('done.');
|
p('done.');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue