Skip to main content

Class: UpdateManager

Constructors

new UpdateManager()

new UpdateManager(urlOrPath, options?, locator?): UpdateManager

Parameters

ParameterType
urlOrPathstring
options?UpdateOptions
locator?VelopackLocatorConfig

Returns

UpdateManager

Methods

checkForUpdatesAsync()

checkForUpdatesAsync(): Promise<UpdateInfo>

Checks for updates, returning None if there are none available. If there are updates available, this method will return an UpdateInfo object containing the latest available release, and any delta updates that can be applied if they are available.

Returns

Promise<UpdateInfo>


downloadUpdateAsync()

downloadUpdateAsync(update, progress?): Promise<void>

Downloads the specified updates to the local app packages directory. Progress is reported back to the caller via an optional Sender. This function will acquire a global update lock so may fail if there is already another update operation in progress.

  • If the update contains delta packages and the delta feature is enabled this method will attempt to unpack and prepare them.
  • If there is no delta update available, or there is an error preparing delta packages, this method will fall back to downloading the full version of the update.

Parameters

ParameterType
updateUpdateInfo
progress?(perc) => void

Returns

Promise<void>


getAppId()

getAppId(): string

Returns the currently installed app id.

Returns

string


getCurrentVersion()

getCurrentVersion(): string

Returns the currently installed version of the app.

Returns

string


getUpdatePendingRestart()

getUpdatePendingRestart(): UpdateInfo

Returns an UpdateInfo object if there is an update downloaded which still needs to be applied. You can pass the UpdateInfo object to waitExitThenApplyUpdate to apply the update.

Returns

UpdateInfo


isPortable()

isPortable(): boolean

Returns whether the app is in portable mode. On Windows this can be true or false. On MacOS and Linux this will always be true.

Returns

boolean


waitExitThenApplyUpdate()

waitExitThenApplyUpdate(update, silent?, restart?, restartArgs?): void

This will launch the Velopack updater and tell it to wait for this program to exit gracefully. You should then clean up any state and exit your app. The updater will apply updates and then optionally restart your app. The updater will only wait for 60 seconds before giving up.

Parameters

ParameterType
updateUpdateInfo
silent?boolean
restart?boolean
restartArgs?string[]

Returns

void