You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

node-wget-js

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-wget-js

Ultra simple async retrieval of remote files over http or https, a fork of `node-wget`

1.0.0
Source
npm
Version published
Weekly downloads
80
-31.03%
Maintainers
1
Weekly downloads
 
Created
Source

node-wget-js

NPM

Dependencies Status Build Status Build Status Code coverage MaintainabilityRelease

Ultra simple async retrieval of remote files over http or https inspired by wgetjs.

This is a fork of node-wget, which still uses request that's now deprecated and using the vulnerability version.

This package is rewritten to use node-fetch.

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}); // dry run, nothing loaded, callback passing parsed options as data

Examples

var wget = require('node-wget-js');

wget('https://raw.github.com/techno-express/node-wget/master/angleman.png');   // angleman.png saved to current folder

wget({
        url:  'https://raw.github.com/techno-express/node-wget/master/package.json',
        dest: '/tmp/',      // destination path or path with filename, 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:');
            console.log(error);            // error encountered
        } else {
            console.log('--- headers:');
            console.log(response.headers); // response headers
            console.log('--- body:');
            console.log(body);             // body properties { bodyUsed: true, size: 1059, timeout: 2000 }
        }
    }
);

// dry run
wget({
    url: 'https://raw.github.com/techno-express/node-wget/master/package.json',
    dest: '/tmp/',
    dry: true
    }, function(err, data) {        // data: { headers:{...}, filepath:'...' }
        console.log('--- dry run data:');
        console.log(data); // '/tmp/package.json'
    }
);

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

Keywords

curl

FAQs

Package last updated on 25 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts