2.2.7 • Published 6 years ago

samss v2.2.7

Weekly downloads
494
License
-
Repository
github
Last release
6 years ago

Simple And Modular Storage System

Changelog

  • Fixed FileStorage#loadSync

  • You can now use Storage#default as a builder. Example: Storage.default().add('hello', 'world').add('test', true).end(). You don't need to save anymore, as long as you use end(). It's an async function.

  • Few other fixes

SAMSS is easy to use:

  • Lightweight
  • Contains 3 storage types: Storage, FileStorage and EncryptedStorage.
  • Based on promises and async/await, but also contains synchronous methods.
  • Uses JSON, but you can create your own custom storage (more informations soon - the API already exists)

Installation

SAMSS requires zero dependencies.

Install SAMSS using npm.

$ npm i samss

How to use

Using the Base Storage

var Storage = require('samss').getStorage();
Storage.set('hello', 'world');

Using the File Storage

var Storage = require('samss').getStorage('FS', '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

var Storage = require('samss').getStorage('Encrypted', 'encrypted_file.random.ext', 'THIS_IS_THE_PASSWORD', 'algorithm');

await Storage.load();

await Storage.default()
.add('hello', 'world')
.add('this', ['is', 'a', 'default', 'value'])
.end();

await Storage.save();

Storage#default()#end() tries to save the storage.

If the file doesn't exist, it gives an empty object, instead of an ENOENT error.

License

This project is licensed under the MIT License. You can check here for more details.

2.2.7

6 years ago

2.2.6

6 years ago

2.2.5

6 years ago

2.2.4

6 years ago

2.2.3

6 years ago

2.2.2

6 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.8

6 years ago

2.0.7

6 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago