Reads INI files to JSON objects with great performance.
- Extremely fast.
- Offers ES, CJS and UMD modules.
- Includes TypeScript types.
- No dependencies.
- Tiny size - 736 B minified, 482 B gzipped, 409 B brotlied.
This is currently work in progress.
import { readFile } from 'fs/promises'
import { read } from 'fast-ini-reader'
// Input:
//
// ; application configuration
// scope = global
//
// [database]
// user = dbuser
// password = dbpassword
// database = use_this_database
const text = await readFile('app.ini', 'utf8')
const file = read(text)
// Result:
// {
// "scope": "global",
// "database": {
// "user": "dbuser",
// "password": "dbpassword",
// "database": "use_this_database"
// }
// }
See also the TypeScript types.
Reads a JSON object from a text
string with INI file contents.
Options:
reviver
: can change key values to a different text
Reviver: reviver(section: string | null, key: string, value: string) => string | undefined