IniParser.js
ini style file parser for node
install
npm i iniparserjs
usage
config.ini
file like:
gkey1=falsegkey2=true [section1]key1=value1key2=value2 [section2]key1=2key2=value2
with IniParser:
var path = var IniParser = var config = path "UTF8" // get all sectionsvar sections = config //get all keys of section1var keysOfSection1 = config //get value by key and sectionvar valueOfkey1InSection2 = config //reset a key-valueconfig//set a new key-valueconfig //resavevar opt = path: path encoding: "UTF8" // default is "UTF8" toDelimiter: "=" // default is "="config //printconsoleconsoleconsoleconsole
output:
sections = [ 'global', 'section1', 'section2' ]keysOfSection1 = [ 'key1', 'key2' ]valueOfkey1InSection2 = 2all =
new_config.ini
file will like:
[global]gkey1=falsegkey2=true [section1]key1=value1key2=value2 [section2]key1=2key2=newValue2 [section3]key1=value1
test
npm run test