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

@cldmv/envm

v1.0.2

Published

Cross-platform environment variable manager for Node.js (ESM, no classes)

Readme

@cldmv/envm

npm version license size npm-downloads github-downloads

@cldmv/envm is a modern, cross-platform environment variable manager for Node.js projects. Designed for both developers and automation, it lets you safely read, write, and manipulate environment variables on Windows and POSIX systems—without ever touching a class. With robust backup and restore features, a powerful CLI, and a clean, ESM-first API, envm makes managing your environment variables simple, safe, and scriptable. Whether you're tweaking your PATH, rolling back a bad change, or automating setup across platforms, envm gives you the control and confidence you need.

Features

  • Cross-platform: Works on Windows (registry) and POSIX (dotfiles, /etc/environment)
  • No classes: API is plain objects and functions
  • Full ESM: Modern, standards-based module
  • PATH-like helpers: Manipulate PATH and similar variables safely
  • Backup/restore: Automatic, timestamped backups with purge and rollback
  • CLI: Powerful envm command for scripting and automation
  • TypeScript-friendly: JSDoc-annotated API
  • Lightweight: Only ~29 KB minified (core + CLI)

Installation

npm install @cldmv/envm

Usage

Node.js API

import { envManager } from "@cldmv/envm";

// Get a variable (expanded)
const value = await envManager.getExpanded("PATH", { scope: "user" });

// Set a variable
await envManager.set("MY_VAR", "value", { scope: "user" });

// Unset a variable
await envManager.unset("MY_VAR", { scope: "user" });

// PATH helpers
await envManager.path.prepend({ name: "PATH", scope: "user", values: ["/usr/local/bin"] });
await envManager.path.append({ name: "PATH", scope: "user", values: ["/opt/bin"] });
await envManager.path.remove({ name: "PATH", scope: "user", values: ["/opt/bin"] });
await envManager.path.sort({ name: "PATH", scope: "user" });
await envManager.path.unique({ name: "PATH", scope: "user" });

// Backup helpers
await envManager.backup.list({ scope: "user" });
await envManager.backup.restore("user-PATH-2025-08-11T12-00-00-000Z.bak");
await envManager.backup.purge({ maxPerScope: 10, maxAgeDays: 7 });

CLI

npx envm get --name PATH --scope user
npx envm set --name MY_VAR --value hello --scope user
npx envm unset --name MY_VAR --scope user
npx envm path prepend --name PATH --values /usr/local/bin --scope user
npx envm backup list --scope user
npx envm backup restore user-PATH-2025-08-11T12-00-00-000Z.bak
npx envm --version

CLI Options

  • --name/-n — Variable name
  • --value/-v — Value to set
  • --scopesession, user, or system
  • --raw — Get raw value (no expansion)
  • --expanded — Get expanded value
  • --backup — Enable/disable backup (default: true)
  • --verify — Enable/disable verification (default: true)
  • --dry-run — Simulate changes

PATH Subcommands

  • prepend, append, remove, sort, unique, get

Backup Subcommands

  • list, restore

API Reference

See JSDoc in source for full details. Key methods:

  • envManager.getRaw(name, { scope })
  • envManager.getExpanded(name, { scope })
  • envManager.set(name, value, { scope, backup, verify, rollbackOnFail })
  • envManager.unset(name, { scope, backup, verify, rollbackOnFail })
  • envManager.path.{get,prepend,append,remove,sort,unique}({ ... })
  • envManager.backup.{list,restore,setBackupDir,getBackupDir,purge}({ ... })

Scopes

  • session: Only affects current process
  • user: User profile (Windows registry or ~/.profile)
  • system: System-wide (Windows registry or /etc/environment)

Safety

  • All changes to user/system env are backed up (unless --backup false)
  • Rollback is attempted on failure if backup is enabled
  • Backups are timestamped and auto-purged

License

Apache-2.0 © Shinrai / CLDMV