super-config-file
v1.0.3
Published
The idea of this package is to allow an application to live reload aspects/configs without restarting.
Downloads
18
Readme
super-config-file
The idea of this package is to allow an application to live reload aspects/configs without restarting.
This will load a config and reload upon changes. It offers event listeners. It also will let you specify a default config to generate. The default config will merge new root elements which don't exist in the old config.
Installation
Use the package manager pip to install foobar.
const SuperConfigFile = require('super-config-file');
//import SuperConfigFile from 'super-config-file';
// Example
const config1 = SuperConfigFile('config.json', {
// Default config (optional, will also merge any missing root fields)
"field": "value"
});
config1.on('read', (config) => { // initial read + reload, useful to initialise/reinitialise objects
console.log(config);
});
config1.on('reload', (config) => { // reload
console.log(config);
});
// Keep demo running to listen for changes
setInterval(() => {}, 500);