Giter Site home page Giter Site logo

openfin / openfin-download Goto Github PK

View Code? Open in Web Editor NEW

This project forked from electron/get

1.0 9.0 0.0 129 KB

downloads an openfin release zip from github

Home Page: https://npm.im/electron-download

License: BSD 3-Clause "New" or "Revised" License

JavaScript 100.00%

openfin-download's Introduction

electron-download

Travis Build Status AppVeyor Build Status

NPM

Downloads an Electron release zip from GitHub.

Used by electron-prebuilt and electron-packager

Usage

Note: Requires Node >= 4.0 to run.

$ npm install --global electron-download
$ electron-download --version=0.31.1
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 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:

## 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:

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:

{
    "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_*)
  2. npm config or .npmrc, lowercase(process.env.npm_config_electron_*)
  3. package.json (process.env.npm_package_config_electron_*)
  4. environment variables (process.env.ELECTRON_*)
  5. the options given to download
  6. 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.

openfin-download's People

Contributors

benlancaster avatar develar avatar fritx avatar kevinsawicki avatar lele85 avatar mafintosh avatar makotot avatar malept avatar marshallofsound avatar maxogden avatar muzuiget avatar obaratch avatar omrilitov avatar popomore avatar quicksnap avatar siilwyn avatar tehbilly avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.