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

removely

v0.3.0

Published

Guarded recursive removal — a delete that cannot name the root it is allowed to touch does not compile

Readme

removely

Guarded removal, temporary trees, and process-holder evidence for Node.js.

import { safeRemove, tempTree, inspectPathHolderCensus } from "removely"

await safeRemove("/tmp/build/output", { within: "/tmp/build" })

await using fixture = await tempTree("build-test-")
const output = fixture.resolve("output.json")

const census = await inspectPathHolderCensus("/tmp/build", {
  scope: "all-visible",
})
console.log(census.holders, census.coverage)

Removal requires an explicit containment root. Missing targets throw unless allowMissing: true is supplied. Containment is a cooperative guard; it does not prevent concurrent filesystem changes or constrain another process.

The async holder census checks cwd, executable, process root, mappings and open descriptors. Its scope is required:

  • all-visible admits every numeric process directory visible in the Linux proc view, including other users. A restricted proc mount may hide processes.
  • same-uid restricts Linux admission to the caller's UID. On Darwin this selects the legacy, unfiltered /usr/sbin/lsof +D mechanism; it does not establish same-UID or host-wide coverage. Darwin rejects all-visible.

The target and platform inspection resources must exist and be readable. Missing required resources and unexpected I/O errors throw with their location. Denied, missing or ambiguous observations make Linux coverage.complete false and name the affected process, source and resource. An individual missing source does not prove its process exited. holders: [] alone never establishes absence.

A complete census describes a non-atomic observation of its stated scope. It cannot exclude later producers, translate mount aliases or establish inode identity, and does not authorize a destructive operation. The synchronous censusProcessCwds API retains its separate, weaker cwd-only contract.

The CLI uses the same removal guard:

removely /tmp/build/output --within /tmp/build

--within is mandatory and has no default: the target must resolve to a path strictly inside it, so --within pointing at the target itself is refused, and so is a sibling that merely shares its prefix. A target that is itself a symlink is refused rather than followed. The root you name must in turn sit inside an allowed root — the system temporary directory by default, and --allowed-root (repeatable) replaces that default rather than adding to it. --allow-missing makes an absent target exit 0.

removely --help     # the whole contract: arguments, what is refused and why,
                    # exit codes, and runnable examples

Exit codes are the shell contract: 0 removed (or absent under --allow-missing, and --help itself), 2 refused or the removal failed, 64 you called it wrong and nothing was removed.

Install from npm; a git install resolves the TypeScript source and runs only under Bun.