How to persist data in an Electron app?

前端 未结 9 1128
刺人心
刺人心 2021-01-30 07:00

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

9条回答
  •  [愿得一人]
    2021-01-30 07:07

    There is a nice module for storing user data in elecron. It's called electron-store.

    Installation

    $ npm install electron-store
    

    Sample usage (copied from github page)

    const Store = require('electron-store');
    const store = new Store();
    
    store.set('unicorn', '

提交回复
热议问题