Open anujdatar opened 3 years ago
I am just working on how to persist app data inside an electron app, and just came across both these packages and this issue. How is electron-store
different from conf
?
On conf
's homepage it says:
It does not support multiple processes writing to the same store.\ I initially made this tool to let command-line tools persist some data.
If you need this for Electron, check out
electron-store
instead.
but as far as I can see, the API is exactly the same, including both of them having the watch
API.
Some benefits of using electron-store
store over conf
:
conf
uses one that is correct for Node.js projects.@ivancuric Multiple Electron processes and multiple Node.js processes are not the same. Electron does have multiple processes, but only one process, the main process, can write to the store directly. For Node.js, however, multiple independent processes could write to the store.
only one process, the main process can write to the store directly
Would it be a good idea to expose electron-store
directly in the renderer process via preload?
I am already using a global state management library, with some stores holding persistent/serializable data. It seems like a good idea to perhaps use electron-store
as a middleware for that one, so I might as well skip the IPC messaging part.
As of electron 12, this module may not be needed anymore. As far as my tests goes, just the basic conf module works just fine.
electron.remote
deprecation was fixed withipc
, but may be completely unnecessary.conf
now gets the correct parentDir values when used with electron directly, unlike earlier versions.I tested this with Electron on linux, using basic
npm start
, as anAppImage
, anddeb
andsnap
packages. They all work fine withconf
.I have not tested with electron 11, this may be true for that as well.