@electron/get

  • Version 2.0.2
  • Published
  • 92.2 kB
  • 8 dependencies
  • MIT license

Install

npm i @electron/get
yarn add @electron/get
pnpm add @electron/get

Overview

Utility for downloading artifacts from different versions of Electron

Index

Functions

function download

download: (
version: string,
options?: ElectronDownloadRequestOptions
) => Promise<string>;
  • Downloads a specific version of Electron and returns an absolute path to a ZIP file.

    Parameter version

    The version of Electron you want to download

function downloadArtifact

downloadArtifact: (
_artifactDetails: ElectronPlatformArtifactDetailsWithDefaults
) => Promise<string>;
  • Downloads an artifact from an Electron release and returns an absolute path to the downloaded file.

    Parameter artifactDetails

    The information required to download the artifact

function getHostArch

getHostArch: () => string;
  • Generates an architecture name that would be used in an Electron or Node.js download file name, from the process module information.

function initializeProxy

initializeProxy: () => void;
  • Initializes a third-party proxy module for HTTP(S) requests.

Interfaces

interface ElectronDownloadRequest

interface ElectronDownloadRequest {}

    property artifactName

    artifactName: string;
    • The type of artifact. For example: * electron * ffmpeg

    property version

    version: string;
    • The version of Electron associated with the artifact.

    interface ElectronDownloadRequestOptions

    interface ElectronDownloadRequestOptions {}

      property cacheRoot

      cacheRoot?: string;
      • The directory that caches Electron artifact downloads.

        The default value is dependent upon the host platform:

        * Linux: $XDG_CACHE_HOME or ~/.cache/electron/ * MacOS: ~/Library/Caches/electron/ * Windows: %LOCALAPPDATA%/electron/Cache or ~/AppData/Local/electron/Cache/

      property checksums

      checksums?: Record<string, string>;
      • Provides checksums for the artifact as strings. Can be used if you already know the checksums of the Electron artifact you are downloading and want to skip the checksum file download without skipping the checksum validation.

        This should be an object whose keys are the file names of the artifacts and the values are their respective SHA256 checksums.

      property downloader

      downloader?: Downloader<DownloadOptions>;
      • The custom [[Downloader]] class used to download artifacts. Defaults to the built-in [[GotDownloader]].

      property downloadOptions

      downloadOptions?: DownloadOptions;
      • Options passed to the downloader module.

      property force

      force?: boolean;
      • Whether to download an artifact regardless of whether it's in the cache directory.

        Defaults to false.

      property mirrorOptions

      mirrorOptions?: MirrorOptions;
      • Options related to specifying an artifact mirror.

      property tempDirectory

      tempDirectory?: string;
      • A temporary directory for downloads. It is used before artifacts are put into cache.

      property unsafelyDisableChecksums

      unsafelyDisableChecksums?: boolean;
      • When set to true, disables checking that the artifact download completed successfully with the correct payload.

        Defaults to false.

      interface MirrorOptions

      interface MirrorOptions {}

        property customDir

        customDir?: string;
        • The name of the directory to download from, often scoped by version number e.g 'v4.0.4'

        property customFilename

        customFilename?: string;
        • The name of the asset to download, e.g 'electron-v4.0.4-linux-x64.zip'

        property customVersion

        customVersion?: string;
        • The version of the asset to download, e.g '4.0.4'

        property mirror

        mirror?: string;
        • The base URL of the mirror to download from, e.g https://github.com/electron/electron/releases/download

        property nightly_mirror

        nightly_mirror?: string;
        • DEPRECATED - see nightlyMirror.

        property nightlyMirror

        nightlyMirror?: string;
        • The Electron nightly-specific mirror URL.

        property resolveAssetURL

        resolveAssetURL?: (opts: DownloadOptions) => Promise<string>;
        • A function allowing customization of the url returned from getArtifactRemoteURL().

        Type Aliases

        type DownloadOptions

        type DownloadOptions = any;

          type ElectronArtifactDetails

          type ElectronArtifactDetails =
          | ElectronPlatformArtifactDetails
          | ElectronGenericArtifactDetails;

            type ElectronGenericArtifactDetails

            type ElectronGenericArtifactDetails = {
            isGeneric: true;
            } & ElectronDownloadRequest &
            ElectronDownloadRequestOptions;

              type ElectronPlatformArtifactDetails

              type ElectronPlatformArtifactDetails = {
              /**
              * The target artifact platform. These are Node-style platform names, for example:
              * * `win32`
              * * `darwin`
              * * `linux`
              */
              platform: string;
              /**
              * The target artifact architecture. These are Node-style architecture names, for example:
              * * `ia32`
              * * `x64`
              * * `armv7l`
              */
              arch: string;
              artifactSuffix?: string;
              isGeneric?: false;
              } & ElectronDownloadRequest &
              ElectronDownloadRequestOptions;

                type ElectronPlatformArtifactDetailsWithDefaults

                type ElectronPlatformArtifactDetailsWithDefaults =
                | (Omit<ElectronPlatformArtifactDetails, 'platform' | 'arch'> & {
                platform?: string;
                arch?: string;
                })
                | ElectronGenericArtifactDetails;

                  type Omit

                  type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;

                    Package Files (4)

                    Dependencies (8)

                    Dev Dependencies (20)

                    Peer Dependencies (0)

                    No peer dependencies.

                    Badge

                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@electron/get.

                    • Markdown
                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@electron/get)
                    • HTML
                      <a href="https://www.jsdocs.io/package/@electron/get"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>