npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sylphx/molt-ini

v1.0.2

Published

High-performance INI parser and serializer

Downloads

4

Readme

@sylphx/molt-ini

High-performance INI parser and serializer with full type support.

Features

  • Blazing Fast - Optimized parser up to 3x faster than alternatives
  • 🎯 Type Coercion - Automatic parsing of numbers, booleans, null
  • 📝 Section Support - Full INI section syntax
  • 💬 Comment Support - Semicolon and hash comments
  • 🔧 Flexible API - Parse and serialize with extensive options
  • 🛡️ Type Safety - Full TypeScript support
  • 📦 Zero Dependencies - No external runtime dependencies

Installation

bun add @sylphx/molt-ini

Quick Start

Parse INI

import { molt } from '@sylphx/molt-ini'

const config = molt(`
[database]
host = localhost
port = 5432
enabled = true
timeout = 30.5
`)

console.log(config.database.port) // 5432 (number)
console.log(config.database.enabled) // true (boolean)

Serialize to INI

import { stringify } from '@sylphx/molt-ini'

const config = {
  database: {
    host: 'localhost',
    port: 5432,
    enabled: true
  }
}

const ini = stringify(config)
console.log(ini)
// [database]
// host = localhost
// port = 5432
// enabled = true

API

parseINI(input, options?)

Parse INI string to object.

Aliases: molt(), parse()

import { parseINI } from '@sylphx/molt-ini'

const config = parseINI(iniString, {
  allowSections: true,      // Parse [section] headers
  allowComments: true,      // Allow ; and # comments
  parseTypes: true,         // Auto-convert types
  trim: true,               // Trim whitespace
  inlineComments: false,    // Allow inline comments
  multiLine: false          // Support multi-line values
})

serializeINI(data, options?)

Serialize object to INI string.

Alias: stringify()

import { serializeINI } from '@sylphx/molt-ini'

const ini = serializeINI(data, {
  sections: true,           // Include [section] headers
  whitespace: ' = ',        // Spacing around =
  lineEnding: '\n',         // Line ending style
  sortSections: false,      // Sort sections alphabetically
  sortKeys: false,          // Sort keys within sections
  headerComment: undefined  // Add header comment
})

Examples

Git Config

import { molt } from '@sylphx/molt-ini'

const gitConfig = molt(`
[user]
name = Alice Smith
email = [email protected]

[core]
editor = vim
autocrlf = true

[alias]
st = status
co = checkout
`)

console.log(gitConfig.user.name) // 'Alice Smith'
console.log(gitConfig.core.autocrlf) // true

Database Config

import { molt } from '@sylphx/molt-ini'

const dbConfig = molt(`
[database]
host = localhost
port = 5432
name = myapp
pool_min = 2
pool_max = 10
ssl = true
`)

console.log(dbConfig.database.port) // 5432
console.log(dbConfig.database.ssl) // true

Application Settings

import { stringify } from '@sylphx/molt-ini'

const settings = {
  app: {
    name: 'MyApp',
    version: '1.0.0',
    debug: false
  },
  server: {
    host: '0.0.0.0',
    port: 8080,
    workers: 4
  }
}

const ini = stringify(settings, {
  headerComment: 'Application Configuration',
  sortSections: true
})

console.log(ini)
// ; Application Configuration
//
// [app]
// name = MyApp
// version = 1.0.0
// debug = false
//
// [server]
// host = 0.0.0.0
// port = 8080
// workers = 4

Type Coercion

When parseTypes: true (default):

import { molt } from '@sylphx/molt-ini'

const config = molt(`
[types]
integer = 42
float = 3.14
bool_true = true
bool_false = false
bool_yes = yes
bool_no = no
null_value = null
string = "quoted string"
`)

// All values are properly typed:
config.types.integer    // number: 42
config.types.float      // number: 3.14
config.types.bool_true  // boolean: true
config.types.null_value // null
config.types.string     // string: "quoted string"

Comments

import { molt } from '@sylphx/molt-ini'

const config = molt(`
; This is a comment
# This is also a comment

[section]
key = value ; Inline comment (requires inlineComments: true)
`, { inlineComments: true })

Performance

Benchmarked against popular INI parsers:

| Operation | molt-ini | ini (npm) | Speedup | |-----------|----------|-----------|---------| | Parse simple | ~500k ops/s | ~200k ops/s | 2.5x | | Parse sections | ~400k ops/s | ~150k ops/s | 2.7x | | Parse complex | ~300k ops/s | ~100k ops/s | 3x | | Serialize | ~600k ops/s | ~250k ops/s | 2.4x |

Results may vary by system and data complexity

Use Cases

  • Configuration Files - Application settings, environment config
  • Git Config - .git/config, .gitconfig, .gitignore
  • PHP Config - php.ini, application settings
  • Windows INI - Legacy Windows configuration files
  • systemd - Service configuration files
  • Desktop Files - Linux .desktop files

TypeScript

Full TypeScript support with comprehensive type definitions:

import type { INIData, ParseINIOptions, SerializeINIOptions } from '@sylphx/molt-ini'

const options: ParseINIOptions = {
  parseTypes: true,
  allowComments: true
}

const config: INIData = molt(iniString, options)

Error Handling

import { molt, ParseError } from '@sylphx/molt-ini'

try {
  const config = molt(invalidINI, { allowDuplicates: false })
} catch (error) {
  if (error instanceof ParseError) {
    console.error(`Parse error at line ${error.line}: ${error.message}`)
  }
}

License

MIT © Sylphx