OverLordGoldDragon
OverLordGoldDragon

Reputation: 19836

How to save user data in electron.js app?

I seek to save user data for my electron.js app. The app has a graph with adjustable values, which disappear when relaunching the app. Demo: https://puu.sh/Bx5Or/ffb0382d0c.gif

How do I preserve these values? Can (and should) it be done with SQL?

Upvotes: 4

Views: 2860

Answers (1)

JeffProd
JeffProd

Reputation: 3148

You have a lot of modules to store data in an Electron app :

I would suggest nedb which is pure JS and cross platform compatible. The simplest is localStorage, which is browser native. Or more simply, you can read/write data in a JSON file.

So, in your case, when the values are changed, save the data. On start, get them from the database and put them in your adjustable values.

Upvotes: 8

Related Questions