Simple function for downloading the main Electron binary ZIP file for a specific version. This is the most common use case for downloading Electron distributions.
Downloads the Electron binary for a specific version and returns an absolute path to the downloaded ZIP file.
/**
* Downloads the Electron binary for a specific version and returns an absolute path to a
* ZIP file.
*
* @param version - The version of Electron you want to download (e.g. `31.0.0`)
* @param options - Options to customize the download behavior
* @returns An absolute path to the downloaded ZIP file
*/
function download(
version: string,
options?: ElectronDownloadRequestOptions
): Promise<string>;Usage Examples:
import { download } from "@electron/get";
// Download latest version
const electronPath = await download('31.0.0');
console.log(`Electron downloaded to: ${electronPath}`);
// Download with custom cache directory
const electronPath = await download('31.0.0', {
cacheRoot: '/custom/cache/dir'
});
// Download with mirror options
const electronPath = await download('31.0.0', {
mirrorOptions: {
mirror: 'https://mirror.example.com/electron/',
customDir: 'v31.0.0',
customFilename: 'electron-v31.0.0-linux-x64.zip'
}
});
// Download with disabled checksums (not recommended)
const electronPath = await download('31.0.0', {
unsafelyDisableChecksums: true
});The version parameter accepts standard semantic version strings:
'31.0.0' - Stable release'31.0.0-beta.1' - Beta release'8.0.0-nightly.20190901' - Nightly releaseWhen called without options, the download function:
process.platform)process.arch)electron artifact (the full Electron binary)Default cache directories by platform:
$XDG_CACHE_HOME or ~/.cache/electron/~/Library/Caches/electron/%LOCALAPPDATA%/electron/Cache or ~/AppData/Local/electron/Cache/