Skip to content

Latest commit

 

History

History
80 lines (50 loc) · 1.31 KB

README.md

File metadata and controls

80 lines (50 loc) · 1.31 KB

electron-data-storage

Simple data persistence for Electron app, It's Thread safety, Can be called directly from the main process and the renderer process.

npm version license

Installation

$ npm install electron-data-storage

or

$ yarn add electron-data-storage

Usage

import storage from 'electron-data-storage'

storage.set('hi', 'Hello World!')
storage.get('hi')
storage.remove('hi')
storage.clear()

You can require this module in Electron main or renderer process.

API

set

storage.set(key: string, value: string | number | boolean)

storage.set(key, value)

get

storage.get(key: string): string | number | boolean | undefined

const value = storage.get(key)
console.log(value)

remove

storage.remove(key: string)

storage.remove(key)

clear

storage.clear()

storage.clear()

Tests

Use Jest, edit in test/index.tset.ts

$ yarn test

Contribute

Contributions are welcome! please open issues and pull request :)

License

The project is licensed under the MIT license.