Skip to content

Instantly share code, notes, and snippets.

@KimuraTakaumi
Created February 21, 2016 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KimuraTakaumi/b317b4133fed996cdb79 to your computer and use it in GitHub Desktop.
Save KimuraTakaumi/b317b4133fed996cdb79 to your computer and use it in GitHub Desktop.
Electronで設定ファイルを保存する ref: http://qiita.com/KimuraTakaumi/items/fcae3fb9ca62143a00b4
$ npm install --save electron-json-storage
const storage = require('electron-json-storage');
storage.get('config', function (error, data) {
if (error) throw error;
if (Object.keys(data).length === 0) {
// データがないときの処理
} else {
// データがあるときの処理
}
});
var json = {
user: 'hoge'
};
storage.set('config', json, function (error) {
if (error) throw error;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment