1

I recently had to update a native module in my electron project. Just to be sure to have a clean installation I first removed all node_modules and reinstalled them via npm install. Then I rebuilt my native module via electron-rebuild

After starting my app, I figured that the localStorage had been reset and all my data had been lost.

Now I am confused. Do I need to worry about localStorage being reset when sending app updates to my clients?

stoefln
  • 14,498
  • 18
  • 79
  • 138
  • What information are you storing in `localStorage`? If it's that important that you are concerned about loosing it you maybe want to store that sort of data in an separate config or even data file – Elias Aug 30 '19 at 10:46

1 Answers1

4

The localStorage does not get lost. By default Electron will store the files (indexDB etc.) under the user's home directory, depending on your operating system:

Windows: C:\Users\<you>\AppData\Local\<Your App Name>
macOS: ~/Library/Application Support/<Your App Name>
Linux: ~/.config/<Your App Name>

Unless you change your application name or otherwise purge your database these files will still be there after each update.

andypotato
  • 703
  • 5
  • 10