Skip to content
/ wgetjs Public
forked from angleman/wgetjs

Ultra simple async retrieval of remote files over http or https

License

Notifications You must be signed in to change notification settings

av4/wgetjs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wgetjs NPM version Build Status Dependency Status License

Ultra simple async retrieval of remote files over http or https

Install

npm install wgetjs

Usage

var wget = require('wgetjs');

wget(url);

wget(url, callback);

wget({url: url, dest: destination_folder_or_filename}, callback);

wget({url: url, dry: true}); // dry run, nothing loaded, callback passing parsed options as data

Examples

var wget = require('wgetjs');

wget('https://raw.github.com/angleman/wgetjs/master/angleman.png');   // angleman.png saved to current folder

wget({
		url:  'https://raw.github.com/angleman/wgetjs/master/package.json',
		dest: '/tmp/',      // destination path or path with filenname, default is ./
		timeout: 2000       // duration to wait for request fulfillment in milliseconds, default is 2 seconds
	},
	function (error, response, body) {
		if (error) {
			console.log(error);            // error encountered
		} else {
			console.log(response.headers); // response headers
			console.log(body);             // content of package
		}
	}
);

// dry run
wget({
	url: 'https://google.com',
	dry: true
}, function(err, res, data) {
	console.log(data.dest); // '/tmp/package.json'
})

License: MIT

About

Ultra simple async retrieval of remote files over http or https

Resources

License

Stars

Watchers

Forks

Packages

No packages published