@robinpath/ini
v0.1.1
Published
Parse, stringify, read, and write INI configuration files
Downloads
162
Readme
@robinpath/ini
Parse, stringify, read, and write INI configuration files
Why use this module?
The ini module lets you:
- Parse an INI string to object
- Convert object to INI string
- Read and parse an INI file
- Write object as INI to file
- Get value by section and key from INI string
All functions are callable directly from RobinPath scripts with a simple, consistent API.
Installation
npm install @robinpath/iniQuick Start
No credentials needed — start using it right away:
ini.stringify $configAvailable Functions
| Function | Description |
|----------|-------------|
| ini.parse | Parse an INI string to object |
| ini.stringify | Convert object to INI string |
| ini.parseFile | Read and parse an INI file |
| ini.writeFile | Write object as INI to file |
| ini.get | Get value by section and key from INI string |
| ini.set | Set value by section and key, return updated INI |
| ini.getSections | Get all section names |
| ini.getKeys | Get all keys in a section |
| ini.removeSection | Remove a section from INI string |
| ini.removeKey | Remove a key from a section |
Examples
Convert object to INI string
ini.stringify $configRead and parse an INI file
ini.parseFile "config.ini"Write object as INI to file
ini.writeFile "config.ini" $objIntegration with RobinPath
import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/ini";
const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);
const result = await rp.executeScript(`
ini.stringify $config
`);Full API Reference
See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.
Related Modules
@robinpath/json— JSON module for complementary functionality
License
MIT
