@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.
npm install @electron/getimport { download, downloadArtifact, Cache, getHostArch, initializeProxy } from "@electron/get";For CommonJS:
const { download, downloadArtifact, Cache, getHostArch, initializeProxy } = require("@electron/get");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();@electron/get is built around several key components:
download, downloadArtifact) for different use casesgot-based implementationSimple function for downloading the main Electron binary ZIP file for a specific version.
function download(
version: string,
options?: ElectronDownloadRequestOptions
): Promise<string>;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>;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,
}Helper functions for architecture detection and proxy initialization.
function getHostArch(): string;
function initializeProxy(): void;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>;
}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>;
}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,
}