Prefs.js
An easy-to-use library providing a simple interface for saving and retrieving key-value pairs in JSON format.
Installation
$ npm install prefs
Usage
const prefs = ;const load add remove clear = ; // or in a shorter way const load add remove clear = './path/to/config';
To start using prefs
, you need to specify a path where the /config
directory will be created, containing the preference files.
e.g.
const load add remove clear = __dirname;
Add a preference
;
Load preferences
; // => { name: 'John', surname: 'Doe' })
Edit a preference
; // => { name: 'Jane', surname: 'Doe' })
Remove a preference
; // => { name: 'Jane' }
Clear all preferences
; // => {}