https://github.com/ozgrozer/electron-store-data
A Node.js module to store Electron datas in the computer
https://github.com/ozgrozer/electron-store-data
data electron store
Last synced: 9 months ago
JSON representation
A Node.js module to store Electron datas in the computer
- Host: GitHub
- URL: https://github.com/ozgrozer/electron-store-data
- Owner: ozgrozer
- License: mit
- Created: 2017-10-29T08:17:22.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-12-20T16:59:42.000Z (about 5 years ago)
- Last Synced: 2024-04-29T18:46:39.912Z (over 1 year ago)
- Topics: data, electron, store
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# electron-store-data
[](https://www.npmjs.com/package/electron-store-data)
[](https://github.com/ozgrozer/electron-store-data/blob/master/license)
A Node.js module to store [Electron](https://github.com/electron/electron) data in the computer.
## Installation
```sh
# npm
npm i electron-store-data
# pnpm
pnpm add electron-store-data
# yarn
yarn add electron-store-data
```
## Usage
```js
// include module
const Store = require('electron-store-data')
// initialize
const storeWindow = new Store({
filename: 'window', // will be window.json
defaults: {
bounds: { x: '', y: '', width: 900, height: 500 }
}
})
// get
console.log(storeWindow.get('bounds'))
// { x: '', y: '', width: 900, height: 500 }
// set
storeWindow.set('bounds', { x: 500, y: 200, width: 800, height: 450 })
// delete
storeWindow.delete('bounds')
```
## Encryption
```js
// initialize
const storeSubscription = new Store({
filename: 'subscription',
encryption: {
enable: true,
salt: 'XXX',
password: 'XXX',
keylen: '', // optional (default: 32)
algorithm: '' // optional (default: aes-256-cbc)
},
defaults: {
plan: 'basic',
license: 'XXXX-XXXX-XXXX-XXXX'
}
})
```
## Contribution
Feel free to contribute. Open a new [issue](https://github.com/ozgrozer/electron-store-data/issues), or make a [pull request](https://github.com/ozgrozer/electron-store-data/pulls).
## License
[MIT](https://github.com/ozgrozer/electron-store-data/blob/master/license)