diff --git a/.changeset/blue-spiders-go.md b/.changeset/blue-spiders-go.md new file mode 100644 index 00000000000..c82c3e014bd --- /dev/null +++ b/.changeset/blue-spiders-go.md @@ -0,0 +1,5 @@ +--- +"electron-updater": minor +--- + +feat: adding external method that allows clearing the update cache diff --git a/packages/electron-updater/src/AppUpdater.ts b/packages/electron-updater/src/AppUpdater.ts index e69afe62d35..7413c250495 100644 --- a/packages/electron-updater/src/AppUpdater.ts +++ b/packages/electron-updater/src/AppUpdater.ts @@ -355,7 +355,7 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter return checkForUpdatesPromise } - public isUpdaterActive(): boolean { + isUpdaterActive(): boolean { const isEnabled = this.app.isPackaged || this.forceDevUpdateConfig if (!isEnabled) { this._logger.info("Skip checkForUpdates because application is not packed and dev update config is not forced") @@ -364,6 +364,11 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter return true } + async clearDownloadCache(): Promise { + const it = await this.getOrCreateDownloadHelper() + return await it.clear() + } + // noinspection JSUnusedGlobalSymbols checkForUpdatesAndNotify(downloadNotification?: DownloadNotification): Promise { return this.checkForUpdates().then(it => {