simple-ini is a JavaScript library designed for parsing and working with INI-formatted configuration files. It provides a straightforward API to load INI content, check for sections and properties, and retrieve values, including support for global properties and multi-line values. The current stable version is 1.0.4, which was last published over eight years ago, indicating it is no longer actively maintained. Its release cadence is effectively none, making it a static utility for basic INI parsing without ongoing updates or modern feature development. Key differentiators at the time of its release included configurable options for case sensitivity, comment characters, and handling of duplicate entries, but it notably lacks explicit TypeScript support or native ESM compatibility, which are common in contemporary configuration libraries.
npm install simple-iniVerified import paths — ran on the pinned version, not inferred.
Demonstrates loading INI content from an array of strings, parsing it, checking for a section, and retrieving property values.
Use `require('simple-ini')` in CommonJS modules. For ESM, a bundler (like Webpack, Rollup, Parcel) that handles CJS interoperability is required, or a manual wrapper/shim if direct ESM usage is critical.For new projects or security-sensitive applications, consider using a more actively maintained INI parsing library, such as 'ini' or 'conf'. If sticking with `simple-ini`, a thorough security audit of its codebase is recommended.
To ignore duplicate properties and only use the last one defined, initialize the parser with `{ throwOnDuplicate: false }`. Example: `new SimpleIni(loadFunc, { throwOnDuplicate: false });`Create a `simple-ini.d.ts` file in your project: `declare module 'simple-ini' { class SimpleIni { constructor(loadFunction: () => string, options?: SimpleIniOptions); hasSection(section: string): boolean; get(config: string): string | undefined; // ... other methods } interface SimpleIniOptions { /* ... */ } export = SimpleIni; }`Ensure you are using the correct CommonJS `require` syntax: `const SimpleIni = require('simple-ini');` in Node.js or a bundler configured for CJS.Either ensure INI files do not have duplicate properties, or initialize `SimpleIni` with `new SimpleIni(loadFunc, { throwOnDuplicate: false });` to silently use the last encountered value for a duplicate key.No dependency data recorded yet.