# electron-download

> download electron prebuilt binary zips from github releases

Latest version **4.1.1** (published 2018-08-16) · BSD-3-Clause license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

Provides the command `electron-download`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 4.1.1 |
| Published | 2018-08-16 |
| First published | 2015-05-10 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 4.0 |
| Dependencies | 9 |
| Unpacked size | 18.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 367 |
| Author | max ogden |
| Maintainers | electron, fritx, jlord, kevinsawicki, mafintosh, marshallofsound, zcbenz, zeke |

## Links

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

## Dependencies (9)

- [rc](https://npm.io/package/rc.md) ^1.2.1
- [debug](https://npm.io/package/debug.md) ^3.0.0
- [nugget](https://npm.io/package/nugget.md) ^2.0.1
- [semver](https://npm.io/package/semver.md) ^5.4.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^4.0.1
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [env-paths](https://npm.io/package/env-paths.md) ^1.0.0
- [sumchecker](https://npm.io/package/sumchecker.md) ^2.0.2
- [path-exists](https://npm.io/package/path-exists.md) ^3.0.0

## Recent versions

- 4.1.1 (latest) — 2018-08-16
- 4.1.0 — 2017-05-10
- 4.0.0 — 2017-02-03
- 3.3.0 — 2017-02-03
- 3.2.0 — 2016-12-28
- 3.1.0 — 2016-12-27
- 3.0.2 — 2016-12-21
- 3.0.1 — 2016-09-27
- 3.0.0 — 2016-09-19
- 2.2.1 — 2016-09-12
- 2.2.0 — 2016-09-10
- 2.1.2 — 2016-04-30
- 2.1.1 — 2016-04-04
- 2.1.0 — 2016-03-13
- 2.0.0 — 2016-03-04
- … 14 more at https://npm.io/package/electron-download/versions

## README

# electron-download

[![Travis Build Status](https://travis-ci.org/electron-userland/electron-download.svg?branch=master)](https://travis-ci.org/electron-userland/electron-download)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/fmfbjmrs42d7bctn/branch/master?svg=true)](https://ci.appveyor.com/project/electron-bot/electron-download/branch/master)

[![NPM](https://nodei.co/npm/electron-download.png?downloads=true)](https://www.npmjs.com/package/electron-download)

Downloads an Electron release zip from GitHub.

Used by [electron-prebuilt](https://npmjs.org/electron-prebuilt) and [electron-packager](https://npmjs.org/electron-packager)

### Usage

**Note: Requires Node >= 4.0 to run.**

```shell
$ npm install --global electron-download
$ electron-download --version=0.31.1
```

```javascript
const download = require('electron-download')

download({
  version: '0.25.1',
  arch: 'ia32',
  platform: 'win32',
  cache: './zips'
}, function (err, zipPath) {
  // zipPath will be the path of the zip that it downloaded.
  // If the zip was already cached it will skip
  // downloading and call the cb with the cached zip path.
  // If it wasn't cached it will download the zip and save
  // it in the cache path.
})
```

If you don't specify `arch` or `platform` args it will use the built-in `os` module to get the values from the current OS. Specifying `version` is mandatory. If there is a `SHASUMS256.txt` file available for the `version`, the file downloaded will be validated against its checksum to ensure that it was downloaded without errors.

You can also use `electron-download` to download the `chromedriver`, `ffmpeg`,
`mksnapshot`, and symbols assets for a specific Electron release. This can be
configured by setting the `chromedriver`, `ffmpeg`, `mksnapshot`, or
`symbols` property to `true` in the specified options object. Only one of
these options may be specified per download call.

You can force a re-download of the asset and the `SHASUM` file by setting the
`force` option to `true`.

If you would like to override the mirror location, three options are available. The mirror URL is composed as `url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + '/' + ELECTRON_CUSTOM_FILENAME`.

You can set the `ELECTRON_MIRROR` or [`NPM_CONFIG_ELECTRON_MIRROR`](https://docs.npmjs.com/misc/config#environment-variables) environment variable or `mirror` opt variable to use a custom base URL for grabbing Electron zips. The same pattern applies to `ELECTRON_CUSTOM_DIR` and `ELECTRON_CUSTOM_FILENAME`:

```plain
## Electron Mirror of China
ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/"

## or for a local mirror
ELECTRON_MIRROR="https://10.1.2.105/"
ELECTRON_CUSTOM_DIR="our/internal/filePath"
ELECTRON_CUSTOM_FILENAME="electron.zip"
```

You can set ELECTRON_MIRROR in `.npmrc` as well, using the lowercase name:

```plain
electron_mirror=https://10.1.2.105/
electron_custom_dir="our/internal/filePath"
electron_custom_filename="electron.zip"
```

You can also set the same variables in your project's package.json:

```json
{
    "name" : "my-electron-project",
    "config" : {
        "electron_mirror": "https://10.1.2.105/",
        "electron_custom_dir": "our/internal/filePath",
        "electron_custom_filename": "electron.zip"
    }
}
```

The order of precedence is:

1. npm config or .npmrc, uppercase (`process.env.NPM_CONFIG_ELECTRON_*`)
1. npm config or .npmrc, lowercase(`process.env.npm_config_electron_*`)
1. package.json (`process.env.npm_package_config_electron_*`)
1. environment variables (`process.env.ELECTRON_*`)
1. the options given to `download`
1. defaults

You can also disable checksum validation if you really want to (this is in
general a bad idea).  Do this by setting `disableChecksumSafetyCheck` to `true`
in the options object.  Use this only when testing local build of Electron,
if you have internal builds of Electron you should generate the SHASUMS file
yourself and let `electron-download` still perform its hash validations.

### Cache location
The location of the cache depends on the operating system, the defaults are:
- Linux: `$XDG_CACHE_HOME` or `~/.cache/electron/`
- MacOS: `~/Library/Caches/electron/`
- Windows: `$LOCALAPPDATA/electron/Cache` or `~/AppData/Local/electron/Cache/`

You can set the `ELECTRON_CACHE` environment variable to set cache location explicitly.

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