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

@ekaone/killx

v0.1.2

Published

A cross-platform process tree killer

Readme

@ekaone/killx

Zero-dependency cross-platform process tree killer.

npm version License: MIT TypeScript


Features

  • 🔪 Kill a process and all its children recursively
  • 🧪 Dry-run mode — preview without killing
  • 🌳 Inspect the full process tree
  • Signal strategy — escalate from SIGTERM → SIGKILL
  • 📦 Zero runtime dependencies
  • 🖥️ Works on Linux, macOS, Windows
  • 🔧 Promise-based API + CLI
  • 📄 Structured JSON output

Install

# As a dependency
pnpm add @ekaone/killx

# Global CLI
pnpm add -g @ekaone/killx

yarn global add @ekaone/killx

npm install -g @ekaone/killx

CLI Usage

# Kill process + all children
killx 1234

# Preview without killing
killx 1234 --dry-run

# Send specific signal
killx 1234 --signal SIGKILL

# Force kill (SIGTERM → SIGKILL escalation)
killx 1234 --force

# JSON output
killx 1234 --json

# Inspect process tree
killx tree 1234
killx inspect 1234 --json

Example Output

Killed:
  - 1235 (node)
  - 1234 (npm)
{
  "success": true,
  "killed": [
    { "pid": 1235, "name": "node" },
    { "pid": 1234, "name": "npm" }
  ]
}

Programmatic API

killx(pid, options?)

import { killx } from "@ekaone/killx";

// Simple kill
const result = await killx(1234);

// Dry run
const preview = await killx(1234, { dryRun: true });

// Force with escalation
const forced = await killx(1234, { force: true, timeout: 3000 });

// Custom strategy
const strategic = await killx(1234, {
  strategy: [
    { signal: "SIGTERM", wait: 2000 },
    { signal: "SIGKILL" },
  ],
});

// Filter specific processes
const filtered = await killx(1234, {
  filter: (proc) => proc.pid !== 9999,
});

KillOptions

| Option | Type | Default | Description | |------------|--------------------------|-------------|------------------------------------------| | signal | NodeJS.Signals\|number | "SIGTERM" | Signal to send | | dryRun | boolean | false | Preview only, do not kill | | force | boolean | false | Escalate to SIGKILL after timeout | | timeout | number | 3000 | ms to wait before SIGKILL (with force) | | strategy | SignalStep[] | — | Multi-step escalation override | | filter | (proc) => boolean | — | Skip processes returning false |

KillResult

type KillResult = {
  success: boolean;
  killed: ProcessInfo[];
  skipped?: ProcessInfo[];
  failed?: { pid: number; error: string }[];
  dryRun?: boolean;
};

inspect(pid)

Returns the full process tree.

import { inspect } from "@ekaone/killx";

const tree = inspect(1234);
// {
//   pid: 1234,
//   name: "node",
//   children: [
//     { pid: 1235, name: "worker" }
//   ]
// }

Design Principles

  • Safe by default — SIGTERM first, opt-in to SIGKILL
  • Dry-run first — always preview before kill
  • JSON-first — structured output for piping
  • No hidden side effects — what you call is what happens
  • Minimal — no framework, no deps, just Node.js primitives

License

MIT © Eka Prasetia

Links


⭐ If this library helps you, please consider giving it a star on GitHub!