atomic-json-store
A configuration store adapted from configstore, with the following key differences:
- Decoupled from file location (a small part's been extracted to
config-root
) - Does not create the JSON file until necessary (
configstore
creates it upon instantiation) - Similarly, on
get
,atomic-json-store
does not create the parent directory - Throws on invalid JSON in the store, instead of rudely deleting the entire configuration
usage
Create a config at ~/.config/my-config.json
:
const JSONStore = const root = const config = configconfigconfigconfigconfigclear
store = Store(path, [options])
- path: where to save the JSON file
Options:
- defaults: an object with default keys and values to save upon instantiation
tip
Instead of setting defaults, which are saved to the JSON file, use family-store
:
const JSONStore = const FamilyStore = const defs = const beep = beep defsbeep // 3000
install
With npm do:
npm install atomic-json-store
license
BSD-2-Clause © ironSource. Original work © Google.