The `ini-api` package provides a robust, class-based API for programmatically parsing, editing, and creating INI configuration files in JavaScript and TypeScript environments. The current stable version is 2.0.2. This library offers distinct classes like `Ini`, `IniSection`, and `IniLine` to represent the structural components of an INI file, allowing for granular manipulation of sections, key-value pairs, and comments. It distinguishes itself by providing a structured object model rather than simple string parsing utilities, enabling developers to interact with INI files using familiar object-oriented patterns. While there isn't a strict release cadence, the project receives updates, with recent significant changes in v2.0.0 (transition to ESM) and v2.0.2 (re-introduction of CJS alongside ESM).
npm install ini-apiVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing, creating, and modifying INI file content using the `Ini` class, showing how to interact with sections and key-value pairs, and generating string output.
For projects requiring CommonJS, upgrade to `ini-api@2.0.2` or later, which reintroduces CommonJS exports alongside ESM. Alternatively, refactor your project to use ESM imports (`import ... from 'ini-api';`).
Ensure your bundler (e.g., Webpack, Rollup) or Node.js environment is configured to correctly resolve CommonJS modules if you intend to use `require()`. For Node.js, explicitly setting `"type": "commonjs"` in your `package.json` for older projects can help, or migrate to ESM imports.
Explicitly pass options to `stringify()` to control the output. For example, use `ini.stringify({ removeBlankLines: true, removeCommentLines: true })` to get a cleaner INI string without unnecessary whitespace and full comment lines.Upgrade to `ini-api@2.0.2` or later and use `require()` syntax, or convert your project to an ES Module by adding `"type": "module"` to `package.json` and updating your scripts.
For `ini-api@2.0.2+`, ensure your environment correctly resolves the CJS export if you insist on `require()`. Otherwise, refactor to use `import { Ini } from 'ini-api';` and ensure your project is configured for ESM.Standardize on either `import` (recommended for modern Node.js/browser environments) or `require()` consistently throughout your project. If using `require()`, explicitly ensure your project isn't configured as an ES Module unless necessary.
No dependency data recorded yet.