Socket
Socket
Sign inDemoInstall

easy-downloader

Package Overview
Dependencies
6
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    easy-downloader

Download file from remote URL easily.


Version published
Weekly downloads
12
increased by200%
Maintainers
1
Install size
106 kB
Created
Weekly downloads
 

Readme

Source

Easy Download

Build Status Test Covarage Latest Version

Download file from remote URL easily.

Installation

$ npm install easy-downloader

Usage

const easyDownload = require("easy-downloader");

(async () => {
  try {
    await easyDownload("https://httpbin.org/image/jpeg", "foo/bar/baz.jpg");
  } catch (error) {
    console.error(error.message);
  }
})();

The foo/bar directory will be created automatically if it does not exist.

API

easyDownload(url, destination, [options]);

Parameters

  • url (String): The file URL to download.
  • destination (String): The path to save the downloaded file.
  • options (optional Object): The HTTP request configuration
    • method (String): The HTTP method to use, default to GET.
    • headers (Object): The request headers to send.
    • auth.username (String): The username for HTTP basic auth.
    • auth.password (String): The password for HTTP basic auth.
    • body (Object|FormData): The request body to send. It can be a plain JavaScript object or an instance of FormData.
    • json (Boolean): Set to true if you want to send the request body with application/json content type. Default to false, which means that the request body will be sent as application/x-www-form-urlencoded. Note that you can still override the content type using the headers option.

License

MIT © Risan Bagja Pradana

Keywords

FAQs

Last updated on 24 Oct 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc