This is a fork. You can find the original source code in https://github.com/yeoman/configstore
Easily load and persist config
$ npm install @harvs-project/piconfigstore
import Configstore from '@harvs-project/piconfigstore';
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
// Create a Configstore instance.
const config = new Configstore(packageJson.name, {foo: 'bar'});
console.log(config.get('foo'));
//=> 'bar'
config.set('awesome', true);
console.log(config.get('awesome'));
//=> true
// Use dot-notation to access nested properties.
config.set('bar.baz', true);
console.log(config.get('bar'));
//=> {baz: true}
config.delete('awesome');
console.log(config.get('awesome'));
//=> undefined
Returns a new instance.
Type: string
Name of your package.
Type: object
Default config.
You can use dot-notation in a key
to access nested properties.
Set an item.
Set multiple items at once.
Get an item.
Check if an item exists.
Delete an item.
Delete all items.
Get the item count.
Get the path to the config file. Can be used to show the user where the config file is located or even better open it for them.
Get all the config as an object or replace the current config with an object:
config.all = {
hello: 'world'
};