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

tessl/npm-electron--get

Utility for downloading artifacts from different versions of Electron

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@electron/get@4.0.x

To install, run

npx @tessl/cli install tessl/npm-electron--get@4.0.0

index.mddocs/

@electron/get

@electron/get is a TypeScript utility for downloading Electron release artifacts and binaries from different versions. It provides intelligent caching, mirror support, proxy configuration, progress tracking, and cross-platform compatibility for downloading official Electron distributions.

Package Information

  • Package Name: @electron/get
  • Package Type: npm
  • Language: TypeScript
  • Installation: npm install @electron/get

Core Imports

import { download, downloadArtifact, Cache, getHostArch, initializeProxy } from "@electron/get";

For CommonJS:

const { download, downloadArtifact, Cache, getHostArch, initializeProxy } = require("@electron/get");

Basic Usage

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

// Simple: Download Electron binary for a specific version
const zipPath = await download('4.0.4');

// Advanced: Download specific artifact (e.g., symbols for macOS)
const symbolsPath = await downloadArtifact({
  version: '4.0.4',
  platform: 'darwin',
  artifactName: 'electron',
  artifactSuffix: 'symbols',
  arch: 'x64',
});

// Use architecture detection
const currentArch = getHostArch();
const zipPathForCurrentArch = await download('4.0.4', {
  cacheMode: ElectronDownloadCacheMode.ReadWrite
});

// Initialize proxy support if needed
initializeProxy();

Architecture

@electron/get is built around several key components:

  • Download Functions: Two main functions (download, downloadArtifact) for different use cases
  • Caching System: Intelligent caching with configurable cache modes to avoid re-downloads
  • Mirror Support: Configurable download sources and CDN support for enterprise environments
  • Downloader Interface: Extensible downloader system with default got-based implementation
  • Proxy Support: HTTP(S) proxy integration via global-agent
  • Cross-platform: Platform-specific cache locations and architecture handling

Capabilities

Basic Electron Download

Simple function for downloading the main Electron binary ZIP file for a specific version.

function download(
  version: string,
  options?: ElectronDownloadRequestOptions
): Promise<string>;

Basic Download

Advanced Artifact Download

Comprehensive function for downloading any Electron release artifact (binaries, symbols, headers, etc.) with full platform and architecture control.

function downloadArtifact(
  artifactDetails: ElectronPlatformArtifactDetailsWithDefaults | ElectronGenericArtifactDetails
): Promise<string>;

Artifact Download

Configuration Options

Complete configuration system for customizing download behavior, caching, mirrors, and proxy settings.

interface ElectronDownloadRequestOptions {
  unsafelyDisableChecksums?: boolean;
  checksums?: Record<string, string>;
  cacheRoot?: string;
  downloadOptions?: DownloadOptions;
  mirrorOptions?: MirrorOptions;
  downloader?: Downloader<DownloadOptions>;
  tempDirectory?: string;
  cacheMode?: ElectronDownloadCacheMode;
}

interface MirrorOptions {
  nightlyMirror?: string;
  mirror?: string;
  customDir?: string;
  customFilename?: string;
  customVersion?: string;
  resolveAssetURL?: (opts: DownloadOptions) => Promise<string>;
}

enum ElectronDownloadCacheMode {
  ReadWrite,
  ReadOnly,
  WriteOnly,
  Bypass,
}

Configuration Options

Utilities

Helper functions for architecture detection and proxy initialization.

function getHostArch(): string;
function initializeProxy(): void;

Utilities

Custom Downloaders

Extensible downloader system allowing custom download implementations.

interface Downloader<T> {
  download(url: string, targetFilePath: string, options: T): Promise<void>;
}

class GotDownloader implements Downloader<GotDownloaderOptions> {
  download(
    url: string,
    targetFilePath: string,
    options?: Partial<GotDownloaderOptions>
  ): Promise<void>;
}

Custom Downloaders

Cache Management

Direct access to the caching system for advanced cache management and inspection.

class Cache {
  constructor(cacheRoot?: string);
  static getCacheDirectory(downloadUrl: string): string;
  getCachePath(downloadUrl: string, fileName: string): string;
  getPathForFileInCache(url: string, fileName: string): string | null;
  putFileInCache(url: string, currentPath: string, fileName: string): Promise<string>;
}

Additional Types

type DownloadOptions = any;

type ElectronPlatformArtifactDetailsWithDefaults = {
  version: string;
  artifactName: string;
  platform?: string;
  arch?: string;
  artifactSuffix?: string;
  isGeneric?: false;
} & ElectronDownloadRequestOptions;

type ElectronGenericArtifactDetails = {
  isGeneric: true;
  version: string;
  artifactName: string;
} & ElectronDownloadRequestOptions;

enum TempDirCleanUpMode {
  CLEAN,
  ORPHAN,
}