0.0.5 • Published 7 years ago

node-app-settings v0.0.5

Weekly downloads
4
License
Apache 2.0
Repository
github
Last release
7 years ago

node-app-settings

Store app settings

npm.io Coveralls

npm package NPM downloads Average time to resolve an issue

Supported Types

  • JSON
  • INI
  • YAML

Usage

You can create settings object by providing setting file path and type. If the file doesn't exist, a new file will be created on the path.

const appSettings = require('node-app-settings');

let iniSetting = appSettings.create('settings.ini', 'INI');
let jsonSetting = appSettings.create('settings.json', 'JSON');
let yamlSetting = appSettings.create('settings.yml', 'YAML');

You can then get/update settings on the object. And if you want to store any settings, don't forget to call flush before exit.

let settings = appSettings.create('settings.json');//Absolute path or relative path
let config = settings.config; //Get the setting data object
config.user = 'Bob';
config.password = 'xxx';
settings.flush((err => {
	console.log(err);
})); //Save to file asynchronous
settings.flushSync(); //Save to file

LICENSE

MIT

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.0

7 years ago

1.0.0

7 years ago

0.0.1

7 years ago