# git-config-ini

> An git config ini encoder/decoder for node

Latest version **2.0.0** (published 2018-05-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install git-config-ini
pnpm add git-config-ini
yarn add git-config-ini
bun add git-config-ini
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2018-05-21 |
| First published | 2018-05-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 0 |
| Unpacked size | 8.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nfer Zhuang |
| Maintainers | nfer |

## Links

- npm: https://www.npmjs.com/package/git-config-ini
- Repository: https://github.com/nfer/git-config-ini
- Homepage: https://github.com/nfer/git-config-ini#readme
- Issues: https://github.com/nfer/git-config-ini/issues
- npm.io page: https://npm.io/package/git-config-ini

## Recent versions

- 2.0.0 (latest) — 2018-05-21
- 1.3.6 — 2018-05-21

## README

[![Build Status](https://travis-ci.org/nfer/git-config-ini.svg?branch=master)](https://travis-ci.org/nfer/git-config-ini)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)


GIT config ini format parser and serializer for node.

## Usage

Consider an git config ini-file `.git/config` that looks like this:

    [core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
    [remote "origin"]
        url = https://github.com/nfer/git-config-ini
        fetch = +refs/heads/*:refs/remotes/origin/*
    [user]
        name = Nfer Zhuang

You can read, manipulate and write the ini-file like so:

    var fs = require('fs')
      , ini = require('ini')

    var config = ini.parse(fs.readFileSync('.git/config', 'utf-8'))

    config.core.filemode = false
    config.user.name = 'nfer'
    config.user.email = 'nfer@nferzhuang.com'

    fs.writeFileSync('.git/config', ini.stringify(config))


## API

### decode(inistring)

Decode the ini-style formatted `inistring` into a nested object.

### parse(inistring)

Alias for `decode(inistring)`

### encode(object)

Encode the object `object` into an ini-style formatted string.

### stringify(object)

Alias for `encode(object)`

### safe(val)

Escapes the string `val` such that it is safe to be used as a key or
value in an ini-file. Basically escapes quotes. For example

    ini.safe('"unsafe string"')

would result in

    "\"unsafe string\""

### unsafe(val)

Unescapes the string `val`

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