@robinpath/toml
v0.1.4
Published
Parse, stringify, and manipulate TOML configuration files
Downloads
450
Readme
@robinpath/toml
Parse, stringify, and manipulate TOML configuration files
Why use this module?
The toml module lets you:
- Parse a TOML string to object
- Convert object to TOML string
- Read and parse a TOML file
- Write object as TOML to file
- Get nested value by dot path from TOML string
All functions are callable directly from RobinPath scripts with a simple, consistent API.
Installation
npm install @robinpath/tomlQuick Start
No credentials needed — start using it right away:
toml.stringify $configAvailable Functions
| Function | Description |
|----------|-------------|
| toml.parse | Parse a TOML string to object |
| toml.stringify | Convert object to TOML string |
| toml.parseFile | Read and parse a TOML file |
| toml.writeFile | Write object as TOML to file |
| toml.get | Get nested value by dot path from TOML string |
| toml.isValid | Check if string is valid TOML |
| toml.toJSON | Convert TOML string to JSON string |
| toml.fromJSON | Convert JSON string to TOML string |
Examples
Convert object to TOML string
toml.stringify $configRead and parse a TOML file
toml.parseFile "config.toml"Write object as TOML to file
toml.writeFile "config.toml" $objIntegration with RobinPath
import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/toml";
const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);
const result = await rp.executeScript(`
toml.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
