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

snipe-port

v1.0.2

Published

Kill processes on a port, but only if they belong to the same project

Readme

snipe-port

Kill processes on a port, but only if they belong to the same project.

Unlike kill-port or fkill, snipe-port checks that the process shares the same working directory or git repo (including worktrees) before killing it. This prevents accidentally killing unrelated processes during development.

Install

npm i -g snipe-port

Usage

CLI

snipe-port 3000           # kill process on port 3000 (if same project)
snipe-port 3000 8080      # multiple ports
snipe-port -p 3000        # --port flag
snipe-port -9 3000        # force kill (SIGKILL)
snipe-port --udp 3000     # target UDP instead of TCP

Programmatic API

import { snipePort } from 'snipe-port'

// Kill process on port 3000 (returns array of killed PIDs)
const killed = await snipePort(3000)

// Force kill with SIGKILL
const killed = await snipePort(3000, { signal: 'SIGKILL' })

// Target UDP
const killed = await snipePort(3000, { method: 'udp' })

How it works

  1. Find PIDs on the given port using lsof (macOS/Linux)
  2. Resolve working directory of each process (lsof -d cwd on macOS, /proc/PID/cwd on Linux)
  3. Check project membership — the process is considered part of the same project if:
    • Its working directory matches the current directory, OR
    • It shares the same git repository root (including git worktrees)
  4. Kill only matching processes with SIGTERM (or SIGKILL with -9)

Why?

During development you often restart servers and need to free up a port. Tools like kill-port will kill any process on that port — including a database, another project's dev server, or a production process you didn't mean to touch.

snipe-port scopes the kill to your current project, so it's safe to use without thinking twice.

Options

| Flag | Description | |------|-------------| | -p, --port <port> | Specify port(s) to kill | | -9, --force | Force kill with SIGKILL | | --udp | Target UDP instead of TCP | | -h, --help | Show help | | -v, --version | Show version |

Requirements

  • Node.js >= 14
  • macOS or Linux (lsof required)

License

MIT