# ini-simple-parser

> A simple, fast and configurable INI parser.

Latest version **1.0.1** (published 2025-01-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install ini-simple-parser
pnpm add ini-simple-parser
yarn add ini-simple-parser
bun add ini-simple-parser
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2025-01-26 |
| First published | 2023-11-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Maintainers | fabiospampinato |
| Keywords | ini, simple, parser, editorconfig |

## Links

- npm: https://www.npmjs.com/package/ini-simple-parser
- Repository: https://github.com/fabiospampinato/ini-simple-parser
- Homepage: https://github.com/fabiospampinato/ini-simple-parser#readme
- Issues: https://github.com/fabiospampinato/ini-simple-parser/issues
- npm.io page: https://npm.io/package/ini-simple-parser

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2025-01-26
- 1.0.0 — 2023-11-14

## README

# INI Simple Parser

A simple, fast and configurable INI parser.

## Install

```sh
npm install ini-simple-parser
```

## Usage

The following options are supported:

```ts
type Options = {
  inferBooleans?: boolean, // Interpret true/TRUE/false/FALSE as booleans
  inferNulls?: boolean, // Interpret null/NULL as nulls
  inferNumbers?: boolean, // Interpret some strings that can be parsed as numbers as numbers
  inferStrings?: boolean, // Automatically remove wrapping quotes from strings
  inlineComments?: boolean // Automatically remove inline comments
};
```

This is how you'd use it:

```ts
import parse from 'ini-simple-parser';

// Let's define some initial string to parse

const INPUT = `
  root=true
  notRoot="false"

  ; last modified 1 April 2001 by John Doe
  [owner]
  name=John Doe
  organization=Acme Widgets Inc.

  [database]
  # use IP address in case network name resolution is not working
  server = 192.0.2.62
  port = 143
  file = "payroll.dat"
  extra1 = something ; Inline comment
  extra2 = something else # Inline comment
  null = null
  nil = "0"
`;

// Let's parse it normally, without setting any options

const parsed = parse ( INPUT );
// {
//   root: 'true',
//   notRoot: '"false"',
//   owner: {
//     name: 'John Doe',
//     organization: 'Acme Widgets Inc.'
//   },
//   database: {
//     server: '192.0.2.62',
//     port: '143',
//     file: '"payroll.dat"',
//     extra1: 'something ; Inline comment',
//     extra2: 'something else # Inline comment',
//     null: 'null',
//     nil: '"0"'
//   }
// }

// Let's parse with every option enabled

const parsed = parse ( INPUT, {
  inferBooleans: true,
  inferNulls: true,
  inferNumbers: true,
  inferStrings: true,
  inlineComments: true
});
// {
//   root: true,
//   notRoot: 'false',
//   owner: {
//     name: 'John Doe',
//     organization: 'Acme Widgets Inc.'
//   },
//   database: {
//     server: '192.0.2.62',
//     port: 143,
//     file: 'payroll.dat',
//     extra1: 'something',
//     extra2: 'something else',
//     null: null,
//     nil: '0'
//   }
// }
```

## License

MIT © Fabio Spampinato

---
_Source: https://npm.io/package/ini-simple-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
