New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

get-down

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-down

Download and optionally extract files

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.5K
decreased by-19.73%
Maintainers
1
Weekly downloads
 
Created
Source

get-down

Download and optionally extract files.

This draws heavily from Bower's download and extract utilities. Those utilities are copyright Twitter and carry the MIT license.

Example use

Download a file and save it to the working directory with the same name:

var download = require('get-down');
download('http://example.com/file.txt');

Same as above, but saving to a different directory:

var download = require('get-down');
download('http://example.com/file.txt', {dest: 'different/directory'});
// the provided directory must already exist

In addition to providing a dest directory, you can provide a new file name:

var download = require('get-down');
download('http://example.com/file.txt', {dest: 'different/name.txt'});
// the provided file must not already exist

The extract option can be used to extract tar, tgz, gz, or zip files:

var download = require('get-down');
download('http://example.com/file.zip', {dest: 'some/directory', extract: true});
// the dest directory must already exist

As you might expect, download is all async. You get an event emitter in return:

var download = require('get-down');
download('http://example.com/file.txt').on('end', function(dest) {
  console.log('downloaded', dest);
});

API Docs

download(url, [options])

Available options:

  • dest - string The destination for saving downloaded resources.
  • extract - boolean Extract the downloaded archive.

The download method returns an event emitter with the following events:

  • progress - Emitted periodically during the download.
  • error - Emitted on any error.
  • end - Emitted when the download is complete. Listeners will be called with the path to the downloaded file (or directory in the case of an extracted archive).

Current Status

FAQs

Package last updated on 08 Jan 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc