# prebuilt-download

> Downloads prebuilt binaries based on URL/filename templates

Latest version **1.0.1** (published 2016-05-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install prebuilt-download
pnpm add prebuilt-download
yarn add prebuilt-download
bun add prebuilt-download
```

## 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 | 1.0.1 |
| Published | 2016-05-16 |
| First published | 2016-05-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Andrew Osheroff |
| Maintainers | andrewosh |
| Keywords | prebuilt, download |

## Links

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

## Dependencies (9)

- [mv](https://npm.io/package/mv.md) ^2.1.1
- [rc](https://npm.io/package/rc.md) ^1.1.6
- [debug](https://npm.io/package/debug.md) ^2.2.0
- [lodash](https://npm.io/package/lodash.md) ^4.11.1
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [nugget](https://npm.io/package/nugget.md) ^2.0.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [home-path](https://npm.io/package/home-path.md) ^1.0.3
- [path-exists](https://npm.io/package/path-exists.md) ^2.1.0

## Recent versions

- 1.0.1 (latest) — 2016-05-16
- 1.0.0 — 2016-05-16

## README

# prebuilt-download

Downloads prebuilt binaries (or arbitrary files, for that matter) according to a URL template string that can be parameterized by architecture, platform and version.

Most of the code is taken from [electron-download](https://github.com/electron-userland/electron-download), and [java-download](https://github.com/blahah/java-download).

### install
`npm install prebuilt-download`

### api
#### `download(opts, cb(err, path))`
Downloads to specified binary, optionally using a cached version instead (see [electron-download](https://github.com/electron-userland/electron-download) for additional options)

### usage

In the simplest case, you only need to pass in filename and url template strings that will be populated with OS values: 
```js
var download = require('prebuilt-download')
var filename = 'electron-v{version}-{platform}-{arch}.zip'
download({
  name: 'electron',
  filename: filename,
  version: '1.1.0',
  url: 'https://github.com/electron/electron/releases/download/v{version}/' + filename
}, function (err, p) {
  ...
})
```

In other cases, you might need to pass in transformation functions that modify the OS values:
``` js
  var filename = 'docker-{version}.tgz'
  download({
    name: 'docker',
    filename: filename,
    version: '1.11.0',
    arch: function (a) {
      if (a === 'ia32') {
        return 'i386'
      } else if (a === 'x64') {
        return 'x86_64'
      }
      return a
    },
    platform: function (p) {
      return _.capitalize(p)
    },
    url: 'https://get.docker.com/builds/{platform}/{arch}/' + filename
  }, function (err, p) {
    ...
  })
})
```
### license
MIT

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