ember-cli-ajh
Version:
Command line tool for developing ambitious ember.js apps
68 lines (39 loc) • 1.31 kB
Markdown
> Easily load and persist config without having to think about where and how
Config is stored in a JSON file located in `$XDG_CONFIG_HOME` or `~/.config`. Eg: `~/.config/configstore/some-id.json`
```js
var Configstore = require('configstore');
var pkg = require('./package.json');
// Init a Configstore instance with an unique ID eg. package name
// and optionally some default values
var conf = new Configstore(pkg.name, {foo: 'bar'});
conf.set('awesome', true);
console.log(conf.get('awesome')); // true
console.log(conf.get('foo')); // bar
conf.del('awesome');
console.log(conf.get('awesome')); // undefined
```
Set an item.
Get an item.
Delete an item.
Delete all items.
Get all items as an object or replace the current config with an object:
```js
conf.all = {
hello: 'world'
};
```
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.
[](http://opensource.org/licenses/bsd-license.php)
Copyright Google