electron-updater module provides auto-update functionality for Electron applications on macOS, Windows, and Linux.
Installation
Quick Start
autoUpdater
The main auto-updater instance, automatically configured based on the current platform.- On Windows: Uses
NsisUpdater - On macOS: Uses
MacUpdater - On Linux: Uses
AppImageUpdater,DebUpdater,RpmUpdater, orPacmanUpdaterbased on package type
AppUpdater Class
Base class for all platform-specific updaters. Source:packages/electron-updater/src/AppUpdater.ts:52
Properties
boolean
default:"true"
Whether to automatically download an update when found.
boolean
default:"true"
Whether to automatically install a downloaded update on app quit.
boolean
default:"true"
Whether to run the app after install when installer is NOT in silent mode.
boolean
default:"false"
Whether to allow update to pre-release versions. Defaults to
true if the application version contains prerelease components.boolean
default:"false"
GitHub provider only. Get all release notes from current version to latest, not just the latest.
boolean
default:"false"
Whether to allow version downgrade (when a user from beta channel wants to go back to stable channel).
boolean
default:"false"
Web installer files might not have signature verification, this prevents loading them unless needed.
boolean
default:"false"
NSIS only. Disable differential downloads and always perform full download of installer.
boolean
default:"false"
Allows developer to force the updater to work in “dev” mode, looking for
dev-app-update.yml instead of app-update.yml.string | null
The update channel. Overrides channel in the update configuration. Setting this automatically sets
allowDowngrade to true.SemVer
The current application version.
OutgoingHttpHeaders | null
Custom request headers.
Logger | null
The logger. Can be
electron-log, winston, or any logger with info(), warn(), error() methods. Set to null to disable logging.Methods
checkForUpdates()
Checks if there is an update available.Promise<UpdateCheckResult | null> - Returns null if updater is disabled, otherwise update information.
Example:
checkForUpdatesAndNotify()
Checks for updates and shows a notification when download completes.DownloadNotification
Custom notification configuration.
downloadUpdate()
Downloads an update. Call this ifautoDownload is false.
CancellationToken
Token to cancel the download.
Promise<Array<string>> - Paths to downloaded files.
Example:
quitAndInstall()
Restarts the app and installs the update.boolean
default:"false"
Windows only. Runs the installer in silent mode.
boolean
default:"false"
Run the app after install even on silent install. Not applicable for macOS. Ignored if
isSilent is false.setFeedURL()
Configures the update provider.PublishConfiguration | AllPublishOptions | string
required
Provider configuration or URL string for generic provider.
addAuthHeader()
Adds an authorization header to requests.string
required
Authorization token (e.g.,
"Bearer <token>" or "token <token>").Events
TheAppUpdater class extends EventEmitter with typed events.
checking-for-update
Emitted when checking for updates starts.update-available
Emitted when an update is available.update-not-available
Emitted when no update is available.download-progress
Emitted during download progress.total: number- Total bytesdelta: number- Delta bytes since last eventtransferred: number- Transferred bytespercent: number- Progress percentagebytesPerSecond: number- Download speed