node-wget-js
Ultra simple async retrieval of remote files over http or https inspired by wgetjs
Install
npm install node-wget-js
Usage
var wget = require('node-wget-js');
wget(url);
wget(url, callback);
wget({url: url, dest: destination_folder_or_filename}, callback);
wget({url: url, dry: true});
Examples
var wget = require('node-wget-js');
wget('https://raw.github.com/techno-express/node-wget/master/angleman.png');
wget({
url: 'https://raw.github.com/techno-express/node-wget/master/package.json',
dest: '/tmp/',
timeout: 2000
},
function (error, response, body) {
if (error) {
console.log('--- error:');
console.log(error);
} else {
console.log('--- headers:');
console.log(response.headers);
console.log('--- body:');
console.log(body);
}
}
);
wget({
url: 'https://raw.github.com/techno-express/node-wget/master/package.json',
dest: '/tmp/',
dry: true
}, function(err, data) {
console.log('--- dry run data:');
console.log(data);
}
);
CLI
Install:
$ npm install -g node-wget-js
Use:
Usage: wget [options] <url>
Ultra simple async retrieval of remote files over http or https
Options:
-h, --help output usage information
-v, --version output version number
-d, --destination <folder> specify download destination
Usage:
# Download file
$ wget https://github.com/NodeOS/NodeOS/archive/master.zip
# Download file to location
$ wget https://github.com/NodeOS/NodeOS/archive/master.zip -d path/to/here/
License: MIT