electron-updater
- Version 6.3.9
- Published
- 466 kB
- 8 dependencies
- MIT license
Install
npm i electron-updater
yarn add electron-updater
pnpm add electron-updater
Overview
Cross platform updater for electron applications
Index
Variables
Classes
AppUpdater
- addAuthHeader()
- allowDowngrade
- allowPrerelease
- app
- autoDownload
- autoInstallOnAppQuit
- autoRunAppAfterInstall
- channel
- checkForUpdates()
- checkForUpdatesAndNotify()
- currentVersion
- differentialDownloadInstaller()
- disableDifferentialDownload
- disableWebInstaller
- dispatchError()
- dispatchUpdateDownloaded()
- doDownloadUpdate()
- downloadedUpdateHelper
- downloadUpdate()
- executeDownload()
- forceDevUpdateConfig
- fullChangelog
- getFeedURL()
- getUpdateInfoAndProvider()
- isUpdaterActive()
- logger
- netSession
- onUpdateAvailable()
- quitAndInstall()
- requestHeaders
- setFeedURL()
- signals
- stagingUserIdPromise
- updateInfoAndProvider
Interfaces
Type Aliases
Variables
variable autoUpdater
const autoUpdater: AppUpdater;
variable DOWNLOAD_PROGRESS
const DOWNLOAD_PROGRESS: string;
variable UPDATE_DOWNLOADED
const UPDATE_DOWNLOADED: string;
Classes
class AppImageUpdater
class AppImageUpdater extends BaseUpdater {}
constructor
constructor(options?: any, app?: any);
method doDownloadUpdate
protected doDownloadUpdate: ( downloadUpdateOptions: DownloadUpdateOptions) => Promise<Array<string>>;
*
method doInstall
protected doInstall: (options: InstallOptions) => boolean;
method isUpdaterActive
isUpdaterActive: () => boolean;
class AppUpdater
abstract class AppUpdater extends AppUpdater_base {}
constructor
protected constructor(options: any, app?: AppAdapter);
property allowDowngrade
allowDowngrade: boolean;
Whether to allow version downgrade (when a user from the beta channel wants to go back to the stable channel).
Taken in account only if channel differs (pre-release version component in terms of semantic versioning).
false
property allowPrerelease
allowPrerelease: boolean;
*GitHub provider only.* Whether to allow update to pre-release versions. Defaults to
true
if application version contains prerelease components (e.g.0.12.1-alpha.1
, herealpha
is a prerelease component), otherwisefalse
.If
true
, downgrade will be allowed (allowDowngrade
will be set totrue
).
property app
protected readonly app: AppAdapter;
property autoDownload
autoDownload: boolean;
Whether to automatically download an update when it is found.
property autoInstallOnAppQuit
autoInstallOnAppQuit: boolean;
Whether to automatically install a downloaded update on app quit (if
quitAndInstall
was not called before).
property autoRunAppAfterInstall
autoRunAppAfterInstall: boolean;
*windows-only* Whether to run the app after finish install when run the installer NOT in silent mode. true
property channel
channel: string;
Get the update channel. Doesn't return
channel
from the update configuration, only if was previously set.
property currentVersion
readonly currentVersion: SemVer;
The current application version.
property disableDifferentialDownload
disableDifferentialDownload: boolean;
*NSIS only* Disable differential downloads and always perform full download of installer.
false
property disableWebInstaller
disableWebInstaller: boolean;
Web installer files might not have signature verification, this switch prevents to load them unless it is needed.
Currently false to prevent breaking the current API, but it should be changed to default true at some point that breaking changes are allowed.
false
property downloadedUpdateHelper
protected downloadedUpdateHelper: DownloadedUpdateHelper;
property forceDevUpdateConfig
forceDevUpdateConfig: boolean;
Allows developer to force the updater to work in "dev" mode, looking for "dev-app-update.yml" instead of "app-update.yml" Dev:
path.join(this.app.getAppPath(), "dev-app-update.yml")
Prod:path.join(process.resourcesPath!, "app-update.yml")
false
property fullChangelog
fullChangelog: boolean;
*GitHub provider only.* Get all release notes (from current version to latest), not just the latest. false
property logger
logger: Logger;
The logger. You can pass [electron-log](https://github.com/megahertz/electron-log), [winston](https://github.com/winstonjs/winston) or another logger with the following interface:
{ info(), warn(), error() }
. Set it tonull
if you would like to disable a logging feature.
property netSession
readonly netSession: Session;
property requestHeaders
requestHeaders: any;
The request headers.
property signals
readonly signals: UpdaterSignal;
For type safety you can use signals, e.g.
autoUpdater.signals.updateDownloaded(() => {})
instead ofautoUpdater.on('update-available', () => {})
property stagingUserIdPromise
protected readonly stagingUserIdPromise: Lazy<string>;
property updateInfoAndProvider
protected updateInfoAndProvider: UpdateInfoAndProvider;
method addAuthHeader
addAuthHeader: (token: string) => void;
Shortcut for explicitly adding auth tokens to request headers
method checkForUpdates
checkForUpdates: () => Promise<UpdateCheckResult | null>;
Asks the server whether there is an update.
method checkForUpdatesAndNotify
checkForUpdatesAndNotify: ( downloadNotification?: DownloadNotification) => Promise<UpdateCheckResult | null>;
method differentialDownloadInstaller
protected differentialDownloadInstaller: ( fileInfo: ResolvedUpdateFileInfo, downloadUpdateOptions: DownloadUpdateOptions, installerPath: string, provider: Provider<any>, oldInstallerFileName: string) => Promise<boolean>;
method dispatchError
protected dispatchError: (e: Error) => void;
method dispatchUpdateDownloaded
protected dispatchUpdateDownloaded: (event: UpdateDownloadedEvent) => void;
method doDownloadUpdate
protected abstract doDownloadUpdate: ( downloadUpdateOptions: DownloadUpdateOptions) => Promise<Array<string>>;
method downloadUpdate
downloadUpdate: ( cancellationToken?: CancellationToken) => Promise<Array<string>>;
Start downloading update manually. You can use this method if
autoDownload
option is set tofalse
.Returns
{Promise<Array>} Paths to downloaded files.
method executeDownload
protected executeDownload: ( taskOptions: DownloadExecutorTask) => Promise<Array<string>>;
method getFeedURL
getFeedURL: () => string | null | undefined;
method getUpdateInfoAndProvider
protected getUpdateInfoAndProvider: () => Promise<UpdateInfoAndProvider>;
method isUpdaterActive
isUpdaterActive: () => boolean;
method onUpdateAvailable
protected onUpdateAvailable: (updateInfo: UpdateInfo) => void;
method quitAndInstall
abstract quitAndInstall: (isSilent?: boolean, isForceRunAfter?: boolean) => void;
Restarts the app and installs the update after it has been downloaded. It should only be called after
update-downloaded
has been emitted.**Note:**
autoUpdater.quitAndInstall()
will close all application windows first and only emitbefore-quit
event onapp
after that. This is different from the normal quit event sequence.Parameter isSilent
*windows-only* Runs the installer in silent mode. Defaults to
false
.Parameter isForceRunAfter
Run the app after finish even on silent install. Not applicable for macOS. Ignored if
isSilent
is set tofalse
(In this case you can still setautoRunAppAfterInstall
tofalse
to prevent run the app after finish).
method setFeedURL
setFeedURL: (options: PublishConfiguration | AllPublishOptions | string) => void;
Configure update provider. If value is
string
, [GenericServerOptions](./publish.md#genericserveroptions) will be set with value asurl
.Parameter options
If you want to override configuration in the
app-update.yml
.
class BaseUpdater
abstract class BaseUpdater extends AppUpdater {}
constructor
protected constructor(options?: any, app?: AppAdapter);
property quitAndInstallCalled
protected quitAndInstallCalled: boolean;
method addQuitHandler
protected addQuitHandler: () => void;
method doInstall
protected abstract doInstall: (options: InstallOptions) => boolean;
method executeDownload
protected executeDownload: ( taskOptions: DownloadExecutorTask) => Promise<Array<string>>;
method install
install: (isSilent?: boolean, isForceRunAfter?: boolean) => boolean;
method quitAndInstall
quitAndInstall: (isSilent?: boolean, isForceRunAfter?: boolean) => void;
method spawnLog
protected spawnLog: ( cmd: string, args?: string[], env?: any, stdio?: StdioOptions) => Promise<boolean>;
This handles both node 8 and node 10 way of emitting error when spawning a process - node 8: Throws the error - node 10: Emit the error(Need to listen with on)
method spawnSyncLog
protected spawnSyncLog: (cmd: string, args?: string[], env?: {}) => string;
method wrapSudo
protected wrapSudo: () => string;
class DebUpdater
class DebUpdater extends BaseUpdater {}
constructor
constructor(options?: any, app?: AppAdapter);
method doDownloadUpdate
protected doDownloadUpdate: ( downloadUpdateOptions: DownloadUpdateOptions) => Promise<Array<string>>;
*
method doInstall
protected doInstall: (options: InstallOptions) => boolean;
class MacUpdater
class MacUpdater extends AppUpdater {}
constructor
constructor(options?: AllPublishOptions, app?: AppAdapter);
method doDownloadUpdate
protected doDownloadUpdate: ( downloadUpdateOptions: DownloadUpdateOptions) => Promise<Array<string>>;
method quitAndInstall
quitAndInstall: () => void;
class NoOpLogger
class NoOpLogger implements Logger {}
class NsisUpdater
class NsisUpdater extends BaseUpdater {}
constructor
constructor(options?: any, app?: AppAdapter);
property installDirectory
installDirectory?: string;
Specify custom install directory path
property verifyUpdateCodeSignature
verifyUpdateCodeSignature: verifyUpdateCodeSignature;
The verifyUpdateCodeSignature. You can pass [win-verify-signature](https://github.com/beyondkmp/win-verify-trust) or another custom verify function:
(publisherName: string[], path: string) => Promise<string | null>
. The default verify function uses [windowsExecutableCodeSignatureVerifier](https://github.com/electron-userland/electron-builder/blob/master/packages/electron-updater/src/windowsExecutableCodeSignatureVerifier.ts)
method doDownloadUpdate
protected doDownloadUpdate: ( downloadUpdateOptions: DownloadUpdateOptions) => Promise<Array<string>>;
*
method doInstall
protected doInstall: (options: InstallOptions) => boolean;
class Provider
abstract class Provider<T extends UpdateInfo> {}
constructor
protected constructor(runtimeOptions: ProviderRuntimeOptions);
property executor
protected readonly executor: ElectronHttpExecutor;
property fileExtraDownloadHeaders
readonly fileExtraDownloadHeaders: any;
property isUseMultipleRangeRequest
readonly isUseMultipleRangeRequest: boolean;
method createRequestOptions
protected createRequestOptions: ( url: URL, headers?: OutgoingHttpHeaders | null) => RequestOptions;
method getCustomChannelName
protected getCustomChannelName: (channel: string) => string;
method getDefaultChannelName
protected getDefaultChannelName: () => string;
method getLatestVersion
abstract getLatestVersion: () => Promise<T>;
method httpRequest
protected httpRequest: ( url: URL, headers?: OutgoingHttpHeaders | null, cancellationToken?: CancellationToken) => Promise<string | null>;
Method to perform API request only to resolve update info, but not to download update.
method resolveFiles
abstract resolveFiles: (updateInfo: T) => Array<ResolvedUpdateFileInfo>;
method setRequestHeaders
setRequestHeaders: (value: OutgoingHttpHeaders | null) => void;
class RpmUpdater
class RpmUpdater extends BaseUpdater {}
constructor
constructor(options?: any, app?: AppAdapter);
method doDownloadUpdate
protected doDownloadUpdate: ( downloadUpdateOptions: DownloadUpdateOptions) => Promise<Array<string>>;
*
method doInstall
protected doInstall: (options: InstallOptions) => boolean;
class UpdaterSignal
class UpdaterSignal {}
constructor
constructor(emitter: EventEmitter);
method login
login: (handler: LoginHandler) => void;
Emitted when an authenticating proxy is [asking for user credentials](https://github.com/electron/electron/blob/master/docs/api/client-request.md#event-login).
method progress
progress: (handler: (info: ProgressInfo) => void) => void;
method updateCancelled
updateCancelled: (handler: (info: UpdateInfo) => void) => void;
method updateDownloaded
updateDownloaded: (handler: (info: UpdateDownloadedEvent) => void) => void;
Interfaces
interface Logger
interface Logger {}
interface ResolvedUpdateFileInfo
interface ResolvedUpdateFileInfo {}
property info
readonly info: UpdateFileInfo;
property packageInfo
packageInfo?: PackageFileInfo;
property url
readonly url: URL;
interface UpdateCheckResult
interface UpdateCheckResult {}
property cancellationToken
readonly cancellationToken?: CancellationToken;
property downloadPromise
readonly downloadPromise?: Promise<Array<string>> | null;
property updateInfo
readonly updateInfo: UpdateInfo;
property versionInfo
readonly versionInfo: UpdateInfo;
Deprecated
interface UpdateDownloadedEvent
interface UpdateDownloadedEvent extends UpdateInfo {}
property downloadedFile
downloadedFile: string;
Type Aliases
type LoginHandler
type LoginHandler = (authInfo: any, callback: LoginCallback) => void;
type UpdaterEvents
type UpdaterEvents = | 'login' | 'checking-for-update' | 'update-available' | 'update-not-available' | 'update-cancelled' | 'download-progress' | 'update-downloaded' | 'error';
type verifyUpdateCodeSignature
type verifyUpdateCodeSignature = ( publisherName: string[], path: string) => Promise<string | null>;
Package Files (9)
Dependencies (8)
Dev Dependencies (6)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/electron-updater
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/electron-updater)
- HTML<a href="https://www.jsdocs.io/package/electron-updater"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4504 ms. - Missing or incorrect documentation? Open an issue for this package.