Update README.
This commit is contained in:
parent
f02c0a6fbf
commit
05b8345650
2 changed files with 25 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
|||
var Curl = require('../lib/Curl')
|
||||
var Curl = require('../lib/Curl');
|
||||
|
||||
var p = console.log;
|
||||
var url = process.argv[2];
|
||||
|
@ -14,10 +14,17 @@ curl.setopt('VERBOSE', 1);
|
|||
|
||||
// on 'data' must be returns chunk.length, or means interrupt the transfer
|
||||
curl.on('data', function(chunk) {
|
||||
p("receive " + chunk.length)
|
||||
p("receive " + chunk.length);
|
||||
return chunk.length;
|
||||
});
|
||||
|
||||
curl.on('header', function(chunk) {
|
||||
p("receive header " + 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) {
|
||||
p("error: " + e.message);
|
||||
curl.close();
|
||||
|
@ -25,9 +32,9 @@ curl.on('error', function(e) {
|
|||
|
||||
|
||||
curl.on('end', function() {
|
||||
p("code: " + curl.getinfo('RESPONSE_CODE'));
|
||||
curl.close();
|
||||
p('code: ' + curl.getinfo('RESPONSE_CODE'));
|
||||
p('done.');
|
||||
curl.close();
|
||||
});
|
||||
|
||||
curl.perform();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue