# write-ini-file

> Stringify and write ini to a file atomically

Latest version **5.0.0** (published 2026-03-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install write-ini-file
pnpm add write-ini-file
yarn add write-ini-file
bun add write-ini-file
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2026-03-11 |
| First published | 2017-04-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=22.13 |
| Dependencies | 2 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 104 |
| Author | Zoltan Kochan |
| Maintainers | zkochan |
| Keywords | write, ini, stringify, file, fs, graceful, atomic, atomically |

## Links

- npm: https://www.npmjs.com/package/write-ini-file
- Repository: https://github.com/zkochan/packages/tree/main/write-ini-file
- Homepage: https://github.com/zkochan/packages/tree/main/write-ini-file#readme#readme
- Issues: https://github.com/zkochan/write-ini-file/issues
- npm.io page: https://npm.io/package/write-ini-file

## Dependencies (2)

- [ini](https://npm.io/package/ini.md) ^6.0.0
- [write-file-atomic](https://npm.io/package/write-file-atomic.md) ^7.0.1

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 5.0.0 (latest) — 2026-03-11
- 3.1.0 (next) — 2021-02-11
- 3.0.0 (pnpm-temp) — 2020-03-26
- 4.0.1 — 2022-12-23
- 4.0.0 — 2022-12-23
- 3.0.2 — 2021-01-09
- 3.0.1 — 2020-11-01
- 2.0.0 — 2018-11-30
- 1.0.0 — 2017-04-16

## README

# write-ini-file

> Stringify and write ini to a file atomically

<!--@shields('npm')-->
[![npm version](https://img.shields.io/npm/v/write-ini-file.svg)](https://www.npmjs.com/package/write-ini-file)
<!--/@-->

## Installation

```sh
<npm|yarn|pnpm> add write-ini-file
```

## Usage

```js
const { writeIniFile } = require('write-ini-file')

writeIniFile('foo.ini', {foo: true}).then(() => {
	console.log('done')
})
```

## API

### `writeIniFile(filepath, data, [options])`

Returns a promise.

### `writeIniFileSync(filepath, data, [options])`

#### options

##### section

Read more at the [ini repo](https://github.com/npm/ini#encodeobject-options).

##### mode

Type: `number`
Default `438` _(0666 in octal)_

[Mode](https://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation) used when writing the file.

## Related

- [read-ini-file](https://github.com/zkochan/packages/tree/main/read-ini-file) - Read and parse an ini file
- [ini](https://github.com/npm/ini) - An ini parser/serializer in JavaScript

## License

[MIT](./LICENSE) © [Zoltan Kochan](https://www.kochan.io)

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