# configparser

> A basic config parser language based off the Python ConfigParser module.

Latest version **0.3.10** (published 2022-10-02) · ISC license · 0 weekly downloads

## Install

```sh
npm install configparser
pnpm add configparser
yarn add configparser
bun add configparser
```

## Health

**Score 35/100 (D)** — status: abandoned.

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.3.10 |
| Published | 2022-10-02 |
| First published | 2017-10-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 22.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Zach Perkitny |
| Maintainers | zachperkitny |
| Keywords | config, parser, configparser, config-parser, ini, node |

## Links

- npm: https://www.npmjs.com/package/configparser
- Repository: https://github.com/ZachPerkitny/configparser
- Homepage: https://github.com/ZachPerkitny/configparser#readme
- Issues: https://github.com/ZachPerkitny/configparser/issues
- npm.io page: https://npm.io/package/configparser

## Dependencies (1)

- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1

## 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

- 0.3.10 (latest) — 2022-10-02
- 0.3.9 — 2021-02-05
- 0.3.8 — 2020-12-14
- 0.3.7 — 2020-11-23
- 0.3.6 — 2019-04-10
- 0.2.6 — 2018-07-08
- 0.1.6 — 2018-05-19
- 0.1.5 — 2017-10-09
- 0.1.4 — 2017-10-07
- 0.0.3 — 2017-10-07
- 0.0.2 — 2017-10-07
- 0.0.1 — 2017-10-07

## README

### Config Parser [![CircleCI](https://circleci.com/gh/ZachPerkitny/configparser.svg?style=svg)](https://circleci.com/gh/ZachPerkitny/configparser)
A NodeJS module based off of Python's ConfigParser. It implements a basic configuration file
parser. The structure is very similar to the Windows INI file.

#### Installation
`npm install configparser`

### Documentation
See Full Documentation [Here](https://zachperkitny.github.io/configparser/)

#### Example
##### Writing

There are two methods available for writing the contents
of the config file to disk: [write](https://zachperkitny.github.io/configparser/ConfigParser.html#write) and [writeAsync](https://zachperkitny.github.io/configparser/ConfigParser.html#writeAsync).

```js
const ConfigParser = require('configparser');

const config = new ConfigParser();

// Adding sections and adding keys
config.addSection('User');
config.set('User', 'token', 'some value');
config.set('User', 'exp', 'some value');

// With String Interpolation, %(key_name)s
config.addSection('MetaData');
config.set('MetaData', 'path', '/home/%(dir_name)s/');
config.set('MetaData', 'dir_name', 'me');

config.write('my-cfg-file.cfg');
```

##### File
```ini
[User]
token=some value
exp=some value

[MetaData]
path=/home/%(dir_name)s/
dir_name=me
```

##### Reading

There are two methods available for reading the contents
of the config file from disk: [read](https://zachperkitny.github.io/configparser/ConfigParser.html#read) and [readAsync](https://zachperkitny.github.io/configparser/ConfigParser.html#readAsync).

```js
config.read('my-cfg-file.cfg');
config.sections(); // ['User', 'MetaData']
config.get('User', 'token'); // 'some value'
config.get('MetaData', 'path'); // '/home/me/'
```

### Questions and Issues
Use the [Github Issue Tracker](https://github.com/ZachPerkitny/configparser/issues) to report a bug, request a feature, or if you need any help.

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