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

@budhash/confix

v2.1.0

Published

Faithful JavaScript port of the confix config-file editor core — update, add, comment, uncomment and delete keys in properties/YAML/INI-style files. Pure text-to-text, zero dependencies.

Readme

@budhash/confix

A faithful JavaScript port of the confix config-file editor's core: update, add, comment, uncomment and delete keys in properties / YAML / INI-style files. Pure text-to-text, zero dependencies, no build step — runs in Node and the browser.

The bash confix script is the reference implementation; this library and the script are validated against one shared conformance suite, so their edits match byte-for-byte. See SPEC.md for the full behavior contract.

Install

npm install @budhash/confix

Usage

// ESM
import { apply, applyBlock, parseCommandBlock } from "@budhash/confix";

// CommonJS
const { apply, applyBlock, parseCommandBlock } = require("@budhash/confix");

const input = "environment=dev\n#debug=false\n";

apply(input, ["environment=prod", ">debug", ">workers=4"]);
// => "environment=prod\ndebug=false\nworkers=4\n"

apply(text, commands, opts?) → string

Applies an ordered list of commands to text and returns the new text. Each command's first character selects the operation:

| Command | Meaning | | ------------ | --------------------------------------------------------- | | key=value | update an existing key (no-op if absent) | | >key=value | set the key, appending it if absent | | >key | uncomment an existing key | | <key | comment out an existing key (line kept) | | !key | delete the key's line entirely (active or commented) |

The key/value split is on the first = in the command, independent of the file separator.

opts:

  • sep — separator between key and value in the file (default "=").
  • comment — comment character (default "#").
apply("gc: 1000\n", ["gc=2001"], { sep: ":" });   // "gc: 2001\n"
apply(";debug=on\n", [">debug"], { comment: ";" }); // "debug=on\n"

applyBlock(text, block, opts?) → string

Convenience: parse a command block (one command per line, like an -e file) and apply it to text in one call. Equivalent to apply(text, parseCommandBlock(block, comment), opts).

applyBlock("port=8080\n#debug=false\n", "port=9090\n>debug\n# a comment");
// => "port=9090\ndebug=false\n"

parseCommandBlock(block, comment?) → string[]

Parses a multi-line command block the way an -e file is read: one command per line, skipping blank lines and lines whose first non-blank character is the comment character (a comment character inside a value is data). Leading blanks on kept commands are stripped.

parseCommandBlock("a=1\n# note\n  >b\n"); // ["a=1", ">b"]

Command line

Installing the package provides a cross-platform confix command that mirrors the bash script flag-for-flag:

npx @budhash/confix -f app.properties "environment=prod" ">debug"

# stdin -> stdout
cat app.properties | npx @budhash/confix "environment=prod"

# preview changes without writing (unified diff)
npx @budhash/confix -d -f app.properties "environment=prod"

| Flag | Meaning | | ---- | ------------------------------------------------------------------ | | -f | input file. -f -, or omitting -f, reads stdin. | | -o | output file. -o- prints to stdout and leaves the input untouched.| | -d | dry run: print a unified diff and write nothing. | | -e | external command file (one command per line). | | -s | separator character (default =). | | -c | comment character (default #). | | -h | show usage. |

Without -o, an edit is applied in place. The Node CLI is a self-contained mirror of the bash tool (including its -d diff) and is validated against it by byte-for-byte parity tests.

In the browser

The core also attaches to the global as confix when loaded without a module system:

<script src="confix.js"></script>
<script>
  confix.apply("a=1\n", ["a=2"]); // "a=2\n"
</script>

License

Apache-2.0