or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

artifact-download.mdbasic-download.mdconfiguration.mddownloaders.mdindex.mdutilities.md
tile.json

configuration.mddocs/

Configuration Options

Complete configuration system for customizing download behavior, caching, mirrors, and proxy settings. All download functions accept these options for fine-grained control.

Capabilities

Download Request Options

Main configuration interface for all download operations.

interface ElectronDownloadRequestOptions {
  /** When set to `true`, disables checking that the artifact download completed successfully with the correct payload. */
  unsafelyDisableChecksums?: boolean;
  /** Provides checksums for the artifact as strings. Can be used if you already know the checksums. */
  checksums?: Record<string, string>;
  /** The directory that caches Electron artifact downloads. */
  cacheRoot?: string;
  /** Options passed to the downloader module. */
  downloadOptions?: DownloadOptions;
  /** Options related to specifying an artifact mirror. */
  mirrorOptions?: MirrorOptions;
  /** A custom Downloader class used to download artifacts. Defaults to the built-in GotDownloader. */
  downloader?: Downloader<DownloadOptions>;
  /** A temporary directory for downloads. */
  tempDirectory?: string;
  /** Controls the cache read and write behavior. */
  cacheMode?: ElectronDownloadCacheMode;
}

Usage Examples:

import { download, ElectronDownloadCacheMode } from "@electron/get";

// Custom cache directory
await download('31.0.0', {
  cacheRoot: '/custom/cache/path'
});

// Disable checksum validation (not recommended)
await download('31.0.0', {
  unsafelyDisableChecksums: true
});

// Provide known checksums to skip checksum file download
await download('31.0.0', {
  checksums: {
    'electron-v31.0.0-linux-x64.zip': '877617029f4c0f2b24f3805a1c3554ba166fda65c4e88df9480ae7b6ffa26a22'
  }
});

// Force cache bypass
await download('31.0.0', {
  cacheMode: ElectronDownloadCacheMode.Bypass
});

Mirror Options

Options for specifying alternative download mirrors and custom URLs.

interface MirrorOptions {
  /** The mirror URL for electron-nightly, which lives in a separate npm package. */
  nightlyMirror?: string;
  /** The base URL of the mirror to download from. */
  mirror?: string;
  /** The name of the directory to download from, often scoped by version number. */
  customDir?: string;
  /** The name of the asset to download. */
  customFilename?: string;
  /** The version of the asset to download. */
  customVersion?: string;
  /** A function allowing customization of the url returned from getArtifactRemoteURL(). */
  resolveAssetURL?: (opts: DownloadOptions) => Promise<string>;
}

Mirror URL Anatomy:

https://github.com/electron/electron/releases/download/v4.0.4/electron-v4.0.4-linux-x64.zip
|                                                     |       |                           |
-------------------------------------------------------       -----------------------------
                        |                                                   |
              mirror / nightlyMirror                  |    |         customFilename
                                                       ------
                                                         ||
                                                      customDir

Usage Examples:

// Custom mirror
await download('31.0.0', {
  mirrorOptions: {
    mirror: 'https://mirror.example.com/electron/',
    customDir: 'custom',
    customFilename: 'unofficial-electron-linux.zip'
  }
});
// Downloads from: https://mirror.example.com/electron/custom/unofficial-electron-linux.zip

// Nightly mirror
await download('8.0.0-nightly.20190901', {
  mirrorOptions: {
    nightlyMirror: 'https://nightly.example.com/',
    customDir: 'nightlies',
    customFilename: 'nightly-linux.zip'
  }
});
// Downloads from: https://nightly.example.com/nightlies/nightly-linux.zip

// Version placeholder in directory
await download('31.0.0', {
  mirrorOptions: {
    mirror: 'https://mirror.example.com/electron/',
    customDir: 'version-{{ version }}' // Becomes 'version-31.0.0'
  }
});

// Custom URL resolution
await download('31.0.0', {
  mirrorOptions: {
    resolveAssetURL: async (opts) => {
      return `https://custom-cdn.com/electron-builds/${opts.version}/electron.zip`;
    }
  }
});

Cache Modes

Controls cache read and write behavior for downloads.

enum ElectronDownloadCacheMode {
  /** Reads from the cache if present, writes to the cache after fetch if not present */
  ReadWrite,
  /** Reads from the cache if present, will not write back to the cache after fetching missing artifact */
  ReadOnly,
  /** Skips reading from the cache, will write back into the cache, overwriting anything currently in the cache after fetch */
  WriteOnly,
  /** Bypasses the cache completely, neither reads from nor writes to the cache */
  Bypass,
}

Cache Mode Behavior:

// Default: ReadWrite - normal caching
await download('31.0.0', {
  cacheMode: ElectronDownloadCacheMode.ReadWrite
});

// ReadOnly - read from cache but don't update it
// Caller owns the returned file and must clean it up
await download('31.0.0', {
  cacheMode: ElectronDownloadCacheMode.ReadOnly
});

// WriteOnly - ignore cache, but update it after download
await download('31.0.0', {
  cacheMode: ElectronDownloadCacheMode.WriteOnly
});

// Bypass - don't use cache at all
// Caller owns the returned file and must clean it up
await download('31.0.0', {
  cacheMode: ElectronDownloadCacheMode.Bypass
});

Download Options

Options passed to the underlying downloader (typically got options).

type DownloadOptions = any; // Custom downloaders can implement any set of options

interface GotDownloaderOptions extends GotOptions {
  isStream?: true;
  /** Progress callback triggered on download progress events */
  getProgressCallback?: (progress: GotProgress) => Promise<void>;
  /** If true, disables the console progress bar */
  quiet?: boolean;
}

Usage Examples:

// Custom timeout and retry options (got options)
await download('31.0.0', {
  downloadOptions: {
    timeout: { response: 30000 },
    retry: { limit: 3 },
    headers: { 'User-Agent': 'MyApp/1.0' }
  }
});

// Progress tracking
await download('31.0.0', {
  downloadOptions: {
    getProgressCallback: async (progress) => {
      console.log(`Download progress: ${Math.round(progress.percent * 100)}%`);
    }
  }
});

// Disable progress bar
await download('31.0.0', {
  downloadOptions: {
    quiet: true
  }
});

Environment Variable Configuration

Mirror and version options can be set via environment variables:

  • ELECTRON_CUSTOM_DIR - Custom directory
  • ELECTRON_CUSTOM_FILENAME - Custom filename
  • ELECTRON_CUSTOM_VERSION - Version override
  • ELECTRON_MIRROR - Mirror URL for stable releases
  • ELECTRON_NIGHTLY_MIRROR - Mirror URL for nightly releases
  • ELECTRON_GET_NO_PROGRESS - Disable progress bar
  • ELECTRON_GET_USE_PROXY - Auto-initialize proxy support

Example:

export ELECTRON_MIRROR="https://internal-mirror.company.com/electron/"
export ELECTRON_CUSTOM_DIR="releases/{{ version }}"
export ELECTRON_GET_NO_PROGRESS=1

Cache Directory Defaults

Default cache locations by platform:

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