Does localStorage get reset when I recompile native modules?

606 views Asked by At

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?

1

There are 1 answers

0
andypotato On

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.