question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

【electron-updater】How to get update cache directory

See original GitHub issue
  • Version: ^22.9.1
  • Electron Version: 11.1.1
  • Electron-updater Version: 4.3.5
  • Target: windows

I want to get the cache path before updating, Some people see others get it in this way

import { autoUpdater } from 'electron-updater'

autoUpdater.app.baseCachePath,

And then I saw a error

The property "app" is protected and can only be accessed in class "AppUpdater" and its subclasses.

I went and looked at the type declaration

export interface AppAdapter {
  readonly baseCachePath: string;
}

So how do I get it?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

1reaction
wakaka378commented, Feb 26, 2021

@idanwork This is how I solve my problem, but it is not an effective way.

In AppUpdater.d.ts, remove the protected of app or use autoUpdater.app.baseCachePath like this autoUpdater[app].baseCachePath. But I think this is unreasonable.

Logically speaking, the app should be accessible by its class. I have also seen people using the app in other blogs.

Then I tried your way and it really works. But the cache paths of different platforms are different. This is more troublesome and you need to write them one by one.

Thank you, I can use this method first, this looks more reliable than modifying the type file

0reactions
stale[bot]commented, Sep 7, 2021

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Auto Update - electron-builder
Install electron -updater as an app dependency. ... Auto update relies only on the first provider in the list (you can specify several...
Read more >
Updating Applications | Electron
The easiest way to use this service is by installing update-electron-app, a Node.js module preconfigured for use with update.electronjs.org. Install the module ...
Read more >
Updating electron's update server value with an app update
Directory for cached update will be cleaned Download block maps ... to C:\Users\USERNAME\AppData\Local\APPNAME-updater\pending\update.exe.
Read more >
CacheStorage - Web APIs | MDN
Provides a master directory of all the named caches that can be accessed by a ... Use CacheStorage.open() to obtain a Cache instance....
Read more >
Electron-Differential-updater
Built on top of electron-updater. Differential Update for mac. Progress for differential update on mac/win. Cache location customization. Many Bug Fixes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found