Registry / serialization / ini-parser

ini-parser

JSON →
library2.0.1jsnpmunverified

ini-parser is a minimalist CommonJS module designed for parsing `.ini` configuration files into JavaScript objects. Currently at version 0.0.2, it was last published over a decade ago (August 2014) and is considered abandoned and unmaintained. It offers synchronous and asynchronous methods for parsing INI files from disk (`parseFileSync`, `parseFile`) and a synchronous method for parsing INI strings (`parse`). Due to its age, it lacks modern features, bug fixes, security updates, and official TypeScript definitions. It is explicitly a CommonJS-only package, making it incompatible with pure ESM projects without a CommonJS wrapper.

npm install ini-parser
INSTALL
IMPORT
SIG · INI-PARSER
I
ini-parser
serializationjavascriptv2.0.1
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.

parser
const parser = require('ini-parser');
import parser from 'ini-parser';
This package is CommonJS-only and does not support ES Modules directly. Attempting to use 'import' will result in a runtime error.
parser.parse
const parsedData = parser.parse(iniString);
const parsedData = require('ini-parser').parse(iniString);
The `parse` method is accessed via the default export object. Direct destructuring from `require()` or calling it without assigning the module to a variable first is not the intended use.
parser.parseFile
parser.parseFile('./config.ini', (err, data) => { /* handle result */ });
parser.parseFile('./config.ini').then(data => { /* ... */ });
The `parseFile` method uses Node.js-style callbacks, not Promises, which is typical for packages from its era.

Demonstrates parsing INI content from a string and from a file, using both synchronous and asynchronous file reading methods.

const parser = require('ini-parser'); const fs = require('fs'); // Create a dummy INI file for demonstration const iniContent = ` [Server] Host=localhost Port=8080 Debug=true [Database] Type=MySQL User=root Password=secret `; fs.writeFileSync('config.ini', iniContent); // 1. Parse a string synchronously const parsedString = parser.parse(iniContent); console.log('Parsed from string:', parsedString); // 2. Parse a file synchronously try { const parsedFile = parser.parseFileSync('config.ini'); console.log('Parsed from file (sync):', parsedFile); } catch (error) { console.error('Error parsing file synchronously:', error.message); } // 3. Parse a file asynchronously parser.parseFile('config.ini', (error, data) => { if (error) { console.error('Error parsing file asynchronously:', error.message); return; } console.log('Parsed from file (async):', data); }); // Clean up the dummy file fs.unlinkSync('config.ini');
Debug
Known issues
breakingThis package is abandoned and has not been updated in over a decade (since August 2014). It contains unpatched vulnerabilities, lacks support for modern JavaScript features, and will not receive any further maintenance or bug fixes.
fix
Migrate to a maintained INI parsing library such as 'ini', '@jedmao/ini-parser', or 'js-ini-parser' which offer active development, better features, and security.
affects: 0.0.2
gotchaThe package is CommonJS-only and relies on `require()`. It is not directly compatible with ES Modules (`import`) without explicit tooling or a CommonJS wrapper.
fix
Use a CommonJS-compatible environment or bundler, or switch to an INI parser that explicitly supports ES Modules.
affects: 0.0.2
gotchaThere are no official TypeScript type definitions available for this package. Using it in a TypeScript project will require manual type declarations or using it with `any` types.
fix
Create a `declarations.d.ts` file with `declare module 'ini-parser';` or use a modern INI parser with built-in TypeScript support like `js-ini-parser` or `@jedmao/ini-parser`.
affects: 0.0.2
gotchaError handling for `parseFile` is callback-based and requires explicit checks for `error` in the callback signature. It does not use Promises.
fix
Ensure the callback function for `parseFile` properly checks its first argument for an `Error` object. Consider wrapping it in a Promise for modern async/await usage if migration isn't an option.
affects: 0.0.2
Errors
Common errors & fixes
Error: ENOENT: no such file or directory, open 'path/to/nonexistent.ini'
The specified file path for `parseFile` or `parseFileSync` does not exist or is inaccessible.
fix
Verify that the file path is correct and the application has read permissions for the file and directory.
TypeError: parser.parse is not a function
Attempting to call `parse` or other methods directly on the `require('ini-parser')` call, or the variable holding the imported module is incorrectly referenced.
fix
Ensure the module is assigned to a variable (e.g., `const parser = require('ini-parser');`) and then methods are called on that variable (e.g., `parser.parse(string)`).
Upgrade
Version history
2.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
ini-parser — npm install ini-parser · libregistry