
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
iniparser-lite
Advanced tools
A robust, streaming INI file parser for Node.js with automatic encoding detection and case-insensitive operations.
A robust, streaming INI file parser for Node.js with automatic encoding detection and case-insensitive operations.
npm install iniparser-lite
const IniParser = require('iniparser-lite');
const parser = new IniParser();
// Parse an INI file section by section
await parser.parseFile('config.ini', (section, data) => {
console.log(`Section: ${section}`);
console.log('Data:', data);
});
const IniParser = require('iniparser-lite');
const parser = new IniParser();
// Update or add a key-value pair (case-insensitive)
await parser.setValue('config.ini', 'Database', 'host', 'localhost');
await parser.setValue('config.ini', 'database', 'PORT', '5432'); // Case doesn't matter
// Control quoting behavior (new feature)
await parser.setValue('config.ini', 'Settings', 'count', '42', { quote: false }); // No quotes
await parser.setValue('config.ini', 'Settings', 'name', 'MyApp', { quote: true }); // Force quotes
await parser.setValue('config.ini', 'Settings', 'enabled', 'true'); // Auto-quoting (no quotes for boolean/numeric)
[Database]
host=localhost
port=5432
username="admin"
password='secret123'
[Application]
name=MyApp
version=1.0.0
debug=true
count=42
enabled=1
parseFile(filePath, onSectionParsed)
Streams and parses INI sections with a callback.
Parameters:
filePath
(string): Path to the INI fileonSectionParsed
(function): Callback function called for each section
section
(string): Section namedata
(object): Key-value pairs in the sectionReturns: Promise
setValue(filePath, section, key, value, options)
Updates or adds a key-value pair under a section directly in the file.
Parameters:
filePath
(string): Path to the INI filesection
(string): Section name (case-insensitive)key
(string): Key name (case-insensitive)value
(string): Value to writeoptions
(object, optional): Configuration options
quote
(boolean): Control quoting behavior
true
: Always add quotes around the valuefalse
: Never add quotes around the valueundefined
(default): Auto-quote based on value typeReturns: Promise
The parser automatically detects file encoding using the first 4KB of the file. Supported encodings include:
chardet
libraryOperations are case-insensitive for matching but preserve original casing:
// Original file has [Database] and Host=localhost
await parser.setValue('config.ini', 'database', 'host', 'newhost');
// Result: [Database] section with Host=newhost (original casing preserved)
The parser now includes intelligent quoting behavior for INI values:
When no quoting option is specified, the parser automatically determines whether to quote values:
// These values are written WITHOUT quotes (numeric/boolean detection)
await parser.setValue('config.ini', 'Settings', 'port', '8080'); // → port=8080
await parser.setValue('config.ini', 'Settings', 'count', '42'); // → count=42
await parser.setValue('config.ini', 'Settings', 'enabled', 'true'); // → enabled=true
await parser.setValue('config.ini', 'Settings', 'disabled', 'false'); // → disabled=false
await parser.setValue('config.ini', 'Settings', 'flag', '1'); // → flag=1
await parser.setValue('config.ini', 'Settings', 'off', '0'); // → off=0
// String values are typically written with quotes when they contain spaces or special characters
await parser.setValue('config.ini', 'Settings', 'name', 'My Application'); // → name="My Application"
await parser.setValue('config.ini', 'Settings', 'path', '/usr/bin'); // → path=/usr/bin
You can explicitly control quoting behavior:
// Force quotes around any value
await parser.setValue('config.ini', 'Settings', 'version', '1.0', { quote: true });
// Result: version="1.0"
// Prevent quotes around any value
await parser.setValue('config.ini', 'Settings', 'title', 'My App', { quote: false });
// Result: title=My App
Values are automatically cleaned of matching quotes during parsing:
key1="value" # Parsed as: value
key2='value' # Parsed as: value
key3="value' # Parsed as: "value' (non-matching quotes)
key4=unquoted # Parsed as: unquoted
The parser gracefully handles:
chardet
, iconv-lite
MIT
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)FAQs
A robust, streaming INI file parser for Node.js with automatic encoding detection and case-insensitive operations.
The npm package iniparser-lite receives a total of 0 weekly downloads. As such, iniparser-lite popularity was classified as not popular.
We found that iniparser-lite demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.