A download tool, now supporting http/https resource and http/https proxy, written in nodejs. Forked from https://github.com/wuchengwei/node-wget - Only one change : when a file is downloaded, if a file with the same name already existed, it will be overwritten and not appened.
npm install git+https://github.com/Pixcell/node-wget.git
varwget=require('wget');varsrc='https://raw.github.com/Fyrd/caniuse/master/data.json';varoutput='/tmp/data.json';varoptions={proxy: 'http://host:port'};vardownload=wget.download(src,output,options);download.on('error',function(err){console.log(err);});download.on('end',function(output){console.log(output);});download.on('progress',function(progress){// code to show progress bar});varwget=require('wget');varoptions={protocol: 'https',host: 'raw.github.com',path: '/Fyrd/caniuse/master/data.json',proxy: 'http://host:port',method: 'GET'};varreq=wget.request(options,function(res){varcontent='';if(res.statusCode===200){res.on('error',function(err){console.log(err);});res.on('data',function(chunk){content+=chunk;});res.on('end',function(){console.log(content);});}else{console.log('Server respond '+res.statusCode);}});req.end();req.on('error',function(err){console.log(err);});