fs-storage-plus
v0.0.5
Published
Encrypted and plain file system key-value storage conforming to the Local Storage API.
Downloads
4
Readme
electron-storage-utils
Utils for storing plain and encrypted JSON in an Electron app's user data directory.
Installation
Using NPM:
npm install electron-storage-utils
Using Yarn:
yarn install electron-storage-utils
Usage
To store and retrieve plain JSON:
let settings = new Storage('settings', { darkMode: true });
settings.save().then(() => {
// settings saved to user data
});
Storage.load('settings').then(instance => {
// instance.data => { darkMode: true }
});
To store and retrieve encrypted JSON:
let secrets = new EncryptedStorage('secrets', { foo: 'bar' });
secrets.save().then(() => {
// secrets encrypted and saved to user data
});
EncryptedStorage.load('secrets').then(instance => {
// instance.data => { foo: 'bar' }
});