request(options, callback)
var wget = require('wget');
var options = {
protocol: 'https',
host: 'raw.github.com',
path: '/Fyrd/caniuse/master/data.json',
proxy: 'http://host:port',
method: 'GET'
};
var req = wget.request(options, function(res) {
var content = '';
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);
});
#download and request method options
options = {}
options.gunzip = false;
options.proxy = {};
options.proxy.protocol = 'http';
options.proxy.host = 'someproxy.org';
options.proxy.port = 1337;
options.proxy.proxyAuth = '{basic auth}';
options.proxy.headers = {'User-Agent': 'Node'};
#Todo
Enable gzip when using request method