0.0.7 • Published 8 months ago

configuration-wrapper v0.0.7

Weekly downloads
11
License
MIT
Repository
github
Last release
8 months ago

Configuration Wrapper

A simple wrapper to handle most of the boilerplate associated with handling configuration files.

Installation:

npm install --save configuration-wrapper

Initialization:

const Configuration = require('configuration-wrapper');

Configuration.fromFile('input.xml');  // load an XML file.
Configuration.fromFile('input.yml');  // load a YAML file.
Configuration.fromFile('input.json'); // load a JSON file.

or

const File = require('fs');

let rawBuf = readFileSync('input.yml'); // YAML, JSON, or XML file

Configuration.fromString(rawBuf.toString())

Other Tricks

output

let cfg = Configuration.fromFile('input.json');

cfg.toJSON();   // output as a JSON string.
cfg.toYAML();   // output as a YAML string.
cfg.toXML();    // output as a XML string.

or from a command line:

bin/to-json.js input.xml
bin/to-yaml.js input.json
bin/to-xml.js input.yml
0.0.5

8 months ago

0.0.7

8 months ago

0.0.6

8 months ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1-beta

3 years ago