super-config-file

1.0.3 • Public • Published

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);

Readme

Keywords

Package Sidebar

Install

npm i super-config-file

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

4.35 kB

Total Files

6

Last publish

Collaborators

  • -nom-