# easy-downloader

> Download file from remote URL easily.

Latest version **2.0.5** (published 2019-10-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install easy-downloader
pnpm add easy-downloader
yarn add easy-downloader
bun add easy-downloader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.5 |
| Published | 2019-10-24 |
| First published | 2018-01-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.0.0 |
| Dependencies | 2 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Risan Bagja Pradana |
| Maintainers | risan |
| Keywords | download, http, http-client |

## Links

- npm: https://www.npmjs.com/package/easy-downloader
- Repository: https://github.com/risan/easy-downloader
- Homepage: https://github.com/risan/easy-downloader#readme
- Issues: https://github.com/risan/easy-downloader/issues
- npm.io page: https://npm.io/package/easy-downloader

## Dependencies (2)

- [send-request](https://npm.io/package/send-request.md) ^1.0.1
- [write-to-file](https://npm.io/package/write-to-file.md) 1.x

## Recent versions

- 2.0.5 (latest) — 2019-10-24
- 2.0.4 — 2019-10-22
- 2.0.3 — 2019-10-22
- 2.0.2 — 2018-12-07
- 2.0.1 — 2018-12-02
- 2.0.0 — 2018-11-29
- 1.0.3 — 2018-03-24
- 1.0.1 — 2018-01-05
- 1.0.0 — 2018-01-01

## README

# Easy Download

[![Build Status](https://badgen.net/travis/risan/easy-downloader)](https://travis-ci.org/risan/easy-downloader)
[![Test Covarage](https://badgen.net/codecov/c/github/risan/easy-downloader)](https://codecov.io/gh/risan/easy-downloader)
[![Latest Version](https://badgen.net/npm/v/easy-downloader)](https://www.npmjs.com/package/easy-downloader)

Download file from remote URL easily.

## Installation

```bash
$ npm install easy-downloader
```

## Usage

```js
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

```js
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`](https://github.com/form-data/form-data).
  * `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.

## Related

* [send-request](https://github.com/risan/send-request): Lightweight HTTP client for Node.

## License

[MIT](https://github.com/risan/easy-downloader/blob/master/LICENSE) © [Risan Bagja Pradana](https://risanb.com)

---
_Source: https://npm.io/package/easy-downloader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
