@electron/get review
@electron/get 5.1.0 downloads Electron release artifacts and returns an absolute file path. Your script must then extract or otherwise consume the file. Use this Node library when you own that download step and need to choose an Electron version, target or cache policy. download() selects the running Node process's platform and architecture; downloadArtifact() accepts an explicit target. For Electron 1.3.2 or newer, validating a cached archive can still require a checksum-manifest request.
Use @electron/get when your script needs to control the Electron artifact download and cache policy. Choose who owns the returned file, verify that the release publishes your target, and account for checksum traffic. The supplied evidence supports these API decisions, but does not establish runtime compatibility or download performance.
Answers from our run
@electron/get or electron: which should you use?
electron: Choose electron when your task is building a desktop app with JavaScript, HTML and CSS. Its npm description identifies that application-building purpose; @electron/get handles the artifact-download step. Use @electron/get when your script needs to control the Electron artifact download and cache policy.
When should you not use @electron/get?
You need a complete application build. This API returns a downloaded file; extraction, packaging and installation require separate steps.
Use it if
- Your Node build script needs a downloaded Electron ZIP path before a separate extraction or installation step.
- You need to request an artifact for a platform and architecture different from the process running the download.
- CI needs an explicit cache policy, such as reading a prepared cache without adding artifacts to it.
- You have trusted artifact checksums and want to supply them instead of downloading a checksum manifest for Electron 1.3.2 or newer.
- You need a complete application build. This API returns a downloaded file; extraction, packaging and installation require separate steps.
- Your build runner is below Node 22.12.0. Version 5.1.0 requires Node 22.12.0 or newer.
- Your offline plan assumes a warm archive cache prevents every network request. For Electron 1.3.2 or newer, validation can fetch SHASUMS256.txt unless you supply checksums.
- You need official win32/ia32 or linux/armv7l artifacts for Electron 44 or newer. The 5.1.0 release note documents an error for those downloads.
- You need a general downloader for arbitrary URLs. This API describes Electron release artifacts and mirror options.
Setup reality
Start with Node 22.12.0 or newer and install the package in the project that owns the download step: npm install --save-dev @electron/get@5.1.0. The npm version metadata declares an ESM package with ./dist/index.js as its export. Save each recipe as a separate .mjs file and pass a published Electron version as the first argument, for example node get-electron.mjs YOUR_RELEASE_VERSION.
The evidence reviewed here consists of npm version metadata and version-pinned source extracts. There is no supplied archive-inspection or execution record. These recipes are source-based illustrations; they were not executed for this correction. No dependency installation, Electron binary download, timing result, platform trial or concurrency result is established by the supplied evidence.
Choose the target before the cache policy. download() sets platform to process.platform and arch to process.arch after spreading its options. Use downloadArtifact() with top-level platform and arch fields for another target. Requesting an archive does not establish that it runs on the build host or that the chosen release publishes that target.
ReadWrite is the documented default. ReadWrite and WriteOnly return paths into the disk cache, so copy those files if another step needs to move or delete them. ReadOnly and Bypass assign cleanup of the returned file to the caller. ReadOnly can download a missing artifact without adding it to the cache. On a cache hit, the implementation copies the artifact into a temporary directory before validation and return.
ReadOnly is not an offline switch. For Electron 1.3.2 or newer, the implementation validates ordinary artifacts unless unsafelyDisableChecksums is enabled. Without supplied checksums, validation requests SHASUMS256.txt with Bypass. A trusted, nonempty checksums map replaces that manifest request while retaining validation. It neither supplies a missing archive nor establishes that all network access is gone. The implementation skips this checksum validation for older Electron versions and for artifact names beginning with SHASUMS256.
Extraction remains separate. The supplied @electron-internal/extract-zip guide addresses that extractor's support boundary. For release packaging, signing or publishing, consult the supplied electron-builder guide. An archive path and checksum comparison do not establish a working desktop installation.
The ratings use documentation-based rubrics stated in each rationale. They are editorial judgments about the supplied evidence, not benchmark or compatibility results.
Patterns
Get the ZIP for the running Node process download-host-archive
import { download } from '@electron/get';
const version = process.argv[2];
if (!version) throw new Error('Pass a published Electron version');
const zipPath = await download(version);
console.log(zipPath);Unexecuted source-based illustration for 5.1.0, as are all recipes on this page. download() selects process.platform and process.arch and returns an absolute ZIP path. Extraction remains separate. Leave the default cache-owned file in place.
Request Linux x64 explicitly request-other-platform
import { downloadArtifact } from '@electron/get';
const version = process.argv[2];
if (!version) throw new Error('Pass a published Electron version');
const zipPath = await downloadArtifact({
version,
artifactName: 'electron',
platform: 'linux',
arch: 'x64',
});
console.log(zipPath);Use top-level target fields on downloadArtifact(). download() sets platform and arch from the running process. This requests an artifact; it does not run the binary or establish that the requested release publishes it.
Put the archive cache under your build workspace choose-cache-root
import { download } from '@electron/get';
import { resolve } from 'node:path';
const version = process.argv[2];
if (!version) throw new Error('Pass a published Electron version');
const zipPath = await download(version, {
cacheRoot: resolve('.cache/electron-artifacts'),
});
console.log(zipPath);cacheRoot selects the artifact cache directory. Preserve or copy the default-mode returned file because it points into that cache. This option neither selects an extraction directory nor disables checksum-manifest requests.
Take ownership of a temporary download bypass-shared-cache
import { download, ElectronDownloadCacheMode } from '@electron/get';
import { copyFile, rm } from 'node:fs/promises';
import { dirname, resolve } from 'node:path';
const version = process.argv[2];
if (!version) throw new Error('Pass a published Electron version');
const temporaryPath = await download(version, {
cacheMode: ElectronDownloadCacheMode.Bypass,
});
try {
await copyFile(temporaryPath, resolve('electron-download.zip'));
} finally {
await rm(dirname(temporaryPath), { recursive: true, force: true });
}Bypass neither reads nor writes the artifact cache. The caller owns cleanup of the returned temporary file. This illustration copies it, then removes its temporary directory. The fixed destination can overwrite an existing file; choose a destination suitable for your job.
Read a prepared cache without adding artifacts read-without-populating-cache
import { download, ElectronDownloadCacheMode } from '@electron/get';
import { copyFile, rm } from 'node:fs/promises';
import { dirname, resolve } from 'node:path';
const version = process.argv[2];
if (!version) throw new Error('Pass a published Electron version');
const temporaryPath = await download(version, {
cacheRoot: resolve('.cache/electron-artifacts'),
cacheMode: ElectronDownloadCacheMode.ReadOnly,
});
try {
await copyFile(temporaryPath, resolve('electron-readonly.zip'));
} finally {
await rm(dirname(temporaryPath), { recursive: true, force: true });
}ReadOnly can fetch a missing artifact without writing it into the cache. On a hit, the implementation copies the cached file into a caller-owned temporary directory. This illustration removes that directory after copying; its destination can overwrite an existing file. For Electron 1.3.2 or newer, checksum validation can still require a manifest request.
Fetch again and update the artifact cache refresh-cache-entry
import { download, ElectronDownloadCacheMode } from '@electron/get';
import { resolve } from 'node:path';
const version = process.argv[2];
if (!version) throw new Error('Pass a published Electron version');
const cachedPath = await download(version, {
cacheRoot: resolve('.cache/electron-artifacts'),
cacheMode: ElectronDownloadCacheMode.WriteOnly,
});
console.log(cachedPath);The enum documents WriteOnly as skipping cache reads and writing the fetched artifact into the cache, overwriting its entry. The returned path points into the cache, so leave it there. No shared-cache concurrency result is supplied.
Provide checksums you already trust supply-trusted-checksums
import { download } from '@electron/get';
import { readFile } from 'node:fs/promises';
const version = process.argv[2];
if (!version) throw new Error('Pass a published Electron version');
const checksums = JSON.parse(
await readFile('trusted-checksums.json', 'utf8'),
);
const zipPath = await download(version, { checksums });
console.log(zipPath);Provide trusted-checksums.json as a nonempty object mapping exact artifact filenames to trusted SHA-256 strings, including the ZIP for the selected version and process target. For Electron 1.3.2 or newer, validation generates its checksum manifest from this map instead of fetching one. The implementation skips checksum validation for older releases. This recipe neither authenticates the map's origin nor guarantees offline operation.
Download a release checksum manifest request-generic-manifest
import { downloadArtifact } from '@electron/get';
import { readFile } from 'node:fs/promises';
const version = process.argv[2];
if (!version) throw new Error('Pass a published Electron version');
const manifestPath = await downloadArtifact({
version,
isGeneric: true,
artifactName: 'SHASUMS256.txt',
});
console.log(await readFile(manifestPath, 'utf8'));Generic artifacts do not require platform or arch. This explicit request uses the default cache policy, unlike the internal validation request that sets Bypass. Artifact names beginning with SHASUMS256 skip checksum validation, so obtaining this text does not independently authenticate it. Leave its default cache-owned path in place.
Alternatives
| Package | Registry | Pick it when |
|---|---|---|
| electron | npm | Choose electron when your task is building a desktop app with JavaScript, HTML and CSS. Its npm description identifies that application-building purpose; @electron/get handles the artifact-download step. |
| @electron/packager | npm | Choose @electron/packager when you need to package an Electron app into OS-specific bundles through JavaScript or a CLI. Its npm description identifies that packaging purpose, which follows obtaining the Electron archive. |
More cli & tooling guides
commander · chalk · click · typescript · esbuild · yargs · the whole shelf →
How this guide is made: grounded in the library's documentation, release notes, changelog, and issue history, on a fixed rubric — not a hands-on install of every release. The 50 most-downloaded entries are additionally install-verified in clean containers. Corrections: contact the desk.