Registry / serialization / simple-ini

simple-ini

JSON →
library1.0.4jsnpmunverified

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-ini
INSTALL
IMPORT
SIG · SIMPLE-INI
S
simple-ini
serializationjavascriptv1.0.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SimpleIni
const SimpleIni = require('simple-ini');
import SimpleIni from 'simple-ini';
This package is CommonJS-only. Direct ESM import via `import` syntax will not work as expected without a transpiler or wrapper.
SimpleIni (CommonJS access)
const { SimpleIni } = require('simple-ini');
import { SimpleIni } from 'simple-ini';
While `require('simple-ini')` returns the constructor directly, some tooling might wrap it. This named import style (even in CJS) is explicit for destructuring in a CJS context, though the package exports the constructor as its default/module.exports. The primary usage shown in the README is `var SimpleIni = require('simple-ini');`.

Demonstrates loading INI content from an array of strings, parsing it, checking for a section, and retrieving property values.

const SimpleIni = require('simple-ini'); const data = [ '[owner]', 'name=John Doe', 'organization=Acme Widgets Inc.', 'description=This is long long \\', ' long long text.' ]; const simpleIni = new SimpleIni(function() { return data.join('\n'); }); if (simpleIni.hasSection('owner')) { console.log('Owner Name:', simpleIni.get('owner.name')); console.log('Owner Organization:', simpleIni.get('owner.organization')); console.log('Owner Description:', simpleIni.get('owner.description')); } // Example of saving (though this package doesn't handle file I/O itself) // simpleIni.save(function(content) { // console.log('Would save content:', content); // });
Debug
Known issues
breakingThis package is CommonJS-only and does not provide native ESM support. Attempting to `import` it directly in an ESM module without a bundler or transpiler may result in runtime errors.
fix
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.
affects: >=1.0.0
gotchaThe package has not been updated in over eight years (since version 1.0.4). This means it is unmaintained and may contain unpatched security vulnerabilities or not support newer JavaScript features or Node.js versions.
fix
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.
affects: >=1.0.0
gotchaBy default, `simple-ini` throws an exception (`throwOnDuplicate: true`) if duplicate properties are encountered within the same section. This can halt application execution if INI files are not strictly unique.
fix
To ignore duplicate properties and only use the last one defined, initialize the parser with `{ throwOnDuplicate: false }`. Example: `new SimpleIni(loadFunc, { throwOnDuplicate: false });`
affects: >=1.0.0
gotchaThe library does not ship with TypeScript type definitions, making it difficult to use with TypeScript projects without creating manual declaration files (`.d.ts`).
fix
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; }`
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: SimpleIni is not a constructor
Attempting to import `simple-ini` using ESM `import` syntax or incorrect CommonJS destructuring in an environment that doesn't handle CJS interop for default exports.
fix
Ensure you are using the correct CommonJS `require` syntax: `const SimpleIni = require('simple-ini');` in Node.js or a bundler configured for CJS.
Error: Duplicate property 'some_property' in section 'some_section'
The INI file being parsed contains two or more entries for the same property within the same section, and the `throwOnDuplicate` option is enabled (which is the default).
fix
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.
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources