I\'ve been scouring the Electron documentation to try and figure out how to persist data in an Electron app. For example, in iOS or OS X, you could use NSUserDefaults to store u
There is an NPM module I wrote called electron-json-storage that is meant to abstract this out and provide a nice and easy interface to the developer.
The module internally reads/writes JSON to/from app.getPath('userData')
:
const storage = require('electron-json-storage');
// Write
storage.set('foobar', { foo: 'bar' }).then(function() {
// Read
storage.get('foobar').then(function(object) {
console.log(object.foo);
// will print "bar"
});
});