A simple storage module.
npm install a-capsule
sh
$ npm i a-capsule
`
How to use
Using the Base (Memory) Storage
`js
let Storage = require('a-capsule').getStorage();
Storage.set('hello', 'world');
`
Using the File Storage
`js
const { FileStorage } = require('a-capsule');
let Storage = new FileStorage('file.json');
Storage.load().then(() => {
await Storage.default()
.add('hello', 'world')
.add('this', ['is', 'a', 'default', 'value'])
.end();
await Storage.save();
}
`
Using the Encrypted Storage
`js
const { EncryptedStorage } = require('a-capsule');
let Storage = new EncryptedStorage('encrypted_file.random.ext', 'THIS_IS_THE_PASSWORD', 'aes256');
await Storage.load();
await Storage.default()
.add('hello', 'world')
.add('this', ['is', 'a', 'default', 'value'])
.end();
await Storage.save();
``