An ini format parser and serializer for node.

Sections are treated as nested objects. Items before the first heading are saved on the object directly.\hypertarget{md_sfcode_node_modules_ini_README_autotoc_md12733}{}\doxysubsection{Usage}\label{md_sfcode_node_modules_ini_README_autotoc_md12733}
Consider an ini-\/file {\ttfamily config.\+ini} that looks like this\+: \begin{DoxyVerb}; this comment is being ignored
scope = global

[database]
user = dbuser
password = dbpassword
database = use_this_database

[paths.default]
datadir = /var/lib/data
array[] = first value
array[] = second value
array[] = third value
\end{DoxyVerb}
 You can read, manipulate and write the ini-\/file like so\+: \begin{DoxyVerb}var fs = require('fs')
  , ini = require('ini')

var config = ini.parse(fs.readFileSync('./config.ini', 'utf-8'))

config.scope = 'local'
config.database.database = 'use_another_database'
config.paths.default.tmpdir = '/tmp'
delete config.paths.default.datadir
config.paths.default.array.push('fourth value')

fs.writeFileSync('./config_modified.ini', ini.stringify(config, { section: 'section' }))
\end{DoxyVerb}
 This will result in a file called {\ttfamily config\+\_\+modified.\+ini} being written to the filesystem with the following content\+: \begin{DoxyVerb}[section]
scope=local
[section.database]
user=dbuser
password=dbpassword
database=use_another_database
[section.paths.default]
tmpdir=/tmp
array[]=first value
array[]=second value
array[]=third value
array[]=fourth value
\end{DoxyVerb}
\hypertarget{md_sfcode_node_modules_ini_README_autotoc_md12734}{}\doxysubsection{API}\label{md_sfcode_node_modules_ini_README_autotoc_md12734}
\hypertarget{md_sfcode_node_modules_ini_README_autotoc_md12735}{}\doxysubsubsection{decode(inistring)}\label{md_sfcode_node_modules_ini_README_autotoc_md12735}
Decode the ini-\/style formatted {\ttfamily inistring} into a nested object.\hypertarget{md_sfcode_node_modules_ini_README_autotoc_md12736}{}\doxysubsubsection{parse(inistring)}\label{md_sfcode_node_modules_ini_README_autotoc_md12736}
Alias for {\ttfamily decode(inistring)}\hypertarget{md_sfcode_node_modules_ini_README_autotoc_md12737}{}\doxysubsubsection{encode(object, \mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_ini_README_autotoc_md12737}
Encode the object {\ttfamily object} into an ini-\/style formatted string. If the optional parameter {\ttfamily section} is given, then all top-\/level properties of the object are put into this section and the {\ttfamily section}-\/string is prepended to all sub-\/sections, see the usage example above.

The {\ttfamily options} object may contain the following\+:


\begin{DoxyItemize}
\item {\ttfamily section} A string which will be the first {\ttfamily section} in the encoded ini data. Defaults to none.
\item {\ttfamily whitespace} Boolean to specify whether to put whitespace around the {\ttfamily =} character. By default, whitespace is omitted, to be friendly to some persnickety old parsers that don\textquotesingle{}t tolerate it well. But some find that it\textquotesingle{}s more human-\/readable and pretty with the whitespace.
\end{DoxyItemize}

For backwards compatibility reasons, if a {\ttfamily string} options is passed in, then it is assumed to be the {\ttfamily section} value.\hypertarget{md_sfcode_node_modules_ini_README_autotoc_md12738}{}\doxysubsubsection{stringify(object, \mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_ini_README_autotoc_md12738}
Alias for {\ttfamily encode(object, \mbox{[}options\mbox{]})}\hypertarget{md_sfcode_node_modules_ini_README_autotoc_md12739}{}\doxysubsubsection{safe(val)}\label{md_sfcode_node_modules_ini_README_autotoc_md12739}
Escapes the string {\ttfamily val} such that it is safe to be used as a key or value in an ini-\/file. Basically escapes quotes. For example \begin{DoxyVerb}ini.safe('"unsafe string"')
\end{DoxyVerb}
 would result in \begin{DoxyVerb}"\"unsafe string\""
\end{DoxyVerb}
 \hypertarget{md_sfcode_node_modules_ini_README_autotoc_md12740}{}\doxysubsubsection{unsafe(val)}\label{md_sfcode_node_modules_ini_README_autotoc_md12740}
Unescapes the string {\ttfamily val} 