# download-to-file

> Download a file to disk programmatically

Latest version **2.1.0** (published 2017-12-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install download-to-file
pnpm add download-to-file
yarn add download-to-file
bun add download-to-file
```

## 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.1.0 |
| Published | 2017-12-03 |
| First published | 2016-12-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Thomas Watson Steen |
| Maintainers | watson |
| Keywords | download, disk, file, save, fs |

## Links

- npm: https://www.npmjs.com/package/download-to-file
- Repository: https://github.com/watson/download-to-file
- Homepage: https://github.com/watson/download-to-file#readme
- Issues: https://github.com/watson/download-to-file/issues
- npm.io page: https://npm.io/package/download-to-file

## Dependencies (2)

- [pump](https://npm.io/package/pump.md) ^2.0.0
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 2.1.0 (latest) — 2017-12-03
- 2.0.0 — 2016-12-27
- 1.0.0 — 2016-12-27

## README

# download-to-file

Download a file to disk programmatically.

[![Build status](https://travis-ci.org/watson/download-to-file.svg?branch=master)](https://travis-ci.org/watson/download-to-file)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)

## Installation

```
npm install download-to-file --save
```

## Usage

```js
var download = require('download-to-file')

console.log('Downloading to /tmp/example.html')
download('http://example.com/', '/tmp/example.html', function (err, filepath) {
  if (err) throw err
  console.log('Download finished:', filepath)
})
```

## API

### `download(url, filepath, callback)`

Will download the content of the given `url` and store it in a file
specified by `filepath`. When done, the `callback` will be called with
an optional error object as the first argument and the `filepath` as the
second argument.

If the server does not return a 200 HTTP status code, the callback will
be called with an error and the file will not be stored on disk.

## License

MIT

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