UIM-Community / nimCfgReader

PDS Configuration file parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nimCfgReader

PDS Configuration file parser

Getting started

This package is available in the Node Package Repository and can be easily installed with npm or yarn.

$ npm i nimcfgreader
# or
$ yarn add nimcfgreader

Example of parsing a UIM Configuration file

<setup>
	loglevel = 5
	probes = cdm,dirscan,processes
</setup>
const nimCfgReader = require('nimcfgreader');

async function main() {
	const config = await (new nimCfgReader('./script.cfg')).read();
	
	const loglevel 	= config.setup.loglevel || 5;
	const probes 	= (config.setup.probes || '').split(',');
}
main().catch(console.error);

Use destructuration to simplify readability

const {
	setup: { 
		loglevel = 5,
		probes = ''
	}
} = await (new nimCfgReader('./script.cfg')).read();

About

PDS Configuration file parser

License:MIT License


Languages

Language:JavaScript 100.0%