electron-updater

  • Version 4.6.1
  • Published
  • 425 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

variable autoUpdater

const autoUpdater: AppUpdater;

    variable DOWNLOAD_PROGRESS

    const DOWNLOAD_PROGRESS: UpdaterEvents;

      variable UPDATE_DOWNLOADED

      const UPDATE_DOWNLOADED: UpdaterEvents;

        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 EventEmitter {}

                  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, here alpha is a prerelease component), otherwise false.

                      If true, downgrade will be allowed (allowDowngrade will be set to true).

                    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 channel

                      channel: string;
                      • Get the update channel. Not applicable for GitHub. Doesn't return channel from the update configuration, only if was previously set.

                      property currentVersion

                      readonly currentVersion: any;
                      • The current application version.

                      property downloadedUpdateHelper

                      protected downloadedUpdateHelper: DownloadedUpdateHelper;

                        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 to null if you would like to disable a logging feature.

                        property netSession

                        readonly netSession: any;

                          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 of autoUpdater.on('update-available', () => {})

                          property stagingUserIdPromise

                          protected readonly stagingUserIdPromise: any;

                            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>;
                              • Asks the server whether there is an update.

                              method checkForUpdatesAndNotify

                              checkForUpdatesAndNotify: (
                              downloadNotification?: DownloadNotification
                              ) => Promise<UpdateCheckResult | null>;

                                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?: any) => Promise<any>;
                                      • Start downloading update manually. You can use this method if autoDownload option is set to false.

                                        Returns

                                        {Promise} Path to downloaded file.

                                      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: any) => 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 emit before-quit event on app 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 to false.

                                                method setFeedURL

                                                setFeedURL: (options: PublishConfiguration | AllPublishOptions | string) => void;
                                                • Configure update provider. If value is string, [GenericServerOptions](/configuration/publish#genericserveroptions) will be set with value as url.

                                                  Parameter options

                                                  If you want to override configuration in the app-update.yml.

                                                class MacUpdater

                                                class MacUpdater extends AppUpdater {}

                                                  constructor

                                                  constructor(options?: any, app?: AppAdapter);

                                                    method doDownloadUpdate

                                                    protected doDownloadUpdate: (
                                                    downloadUpdateOptions: DownloadUpdateOptions
                                                    ) => Promise<Array<string>>;

                                                      method quitAndInstall

                                                      quitAndInstall: () => void;

                                                        class NoOpLogger

                                                        class NoOpLogger implements Logger {}

                                                        method error

                                                        error: (message?: any) => void;

                                                          method info

                                                          info: (message?: any) => void;

                                                            method warn

                                                            warn: (message?: any) => void;

                                                              class NsisUpdater

                                                              class NsisUpdater 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 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: any,
                                                                              headers?: OutgoingHttpHeaders | null
                                                                              ) => any;

                                                                                method getCustomChannelName

                                                                                protected getCustomChannelName: (channel: string) => string;

                                                                                  method getDefaultChannelName

                                                                                  protected getDefaultChannelName: () => string;

                                                                                    method getLatestVersion

                                                                                    abstract getLatestVersion: () => Promise<T>;

                                                                                      method httpRequest

                                                                                      protected httpRequest: (
                                                                                      url: any,
                                                                                      headers?: OutgoingHttpHeaders | null,
                                                                                      cancellationToken?: any
                                                                                      ) => 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 UpdaterSignal

                                                                                          class UpdaterSignal {}

                                                                                            constructor

                                                                                            constructor(emitter: any);

                                                                                              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: any) => void) => void;

                                                                                                method updateCancelled

                                                                                                updateCancelled: (handler: (info: any) => void) => void;

                                                                                                  method updateDownloaded

                                                                                                  updateDownloaded: (handler: (info: UpdateDownloadedEvent) => void) => void;

                                                                                                    Interfaces

                                                                                                    interface Logger

                                                                                                    interface Logger {}

                                                                                                      method debug

                                                                                                      debug: (message: string) => void;

                                                                                                        method error

                                                                                                        error: (message?: any) => void;

                                                                                                          method info

                                                                                                          info: (message?: any) => void;

                                                                                                            method warn

                                                                                                            warn: (message?: any) => void;

                                                                                                              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';

                                                                                                                                      Package Files (6)

                                                                                                                                      Dependencies (8)

                                                                                                                                      Dev Dependencies (4)

                                                                                                                                      Peer Dependencies (0)

                                                                                                                                      No peer dependencies.

                                                                                                                                      Badge

                                                                                                                                      To add a badge like this onejsDocs.io badgeto 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>