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

unique-pid

v0.1.1

Published

Unique, serializable process IDs for Node.js

Readme

unique-pid

Save a process ID and identify the same process later.

Operating systems recycle PIDs. A PID saved in a file can eventually belong to an unrelated process. unique-pid combines the PID with its exact OS-reported start identity in a serializable token, so you can tell them apart.

Capture the token when a process starts, store it in a file or database, and check it later, even from another invocation of your CLI. Supports macOS, Linux, and Windows. No ps required.

import { capture, check } from "unique-pid";

const captured = capture(process.pid);
if (!captured.ok) {
  console.error(captured.error);
} else {
  const checked = check(captured.value);
  console.log(checked); // { ok: true, value: 'same' }
}

API

All functions return { ok: true, value } or { ok: false, error: { code, message } }. Invalid input, unavailable native binaries, and permission failures are results, not thrown exceptions.

  • capture(pid) returns a serializable identity token.
  • check(token) returns same, different, or gone.
  • decode(token) returns the token's validated fields for inspection.

An inspection error is not proof that a process is gone. Tokens use exact OS start values, not approximate dates. Linux also includes boot and PID namespace identity. macOS uses the process's microsecond start timestamp and includes boot identity when permitted. Windows uses the process's 64-bit creation time. Without boot identity, a repeated PID and exact timestamp after a reboot or clock reset cannot be distinguished. A saved macOS token with boot identity still requires permission to verify that identity.

Tokens belong in trusted state on the originating machine. They are not credentials. Identity checks do not prove ownership or make a later PID-based signal atomic. This package does not terminate processes.

Development

Node 20.19.4+ (20.x) or 22.12+. Native development builds require Python and Xcode Command Line Tools on macOS, or Visual Studio C++ Build Tools on Windows. Linux reads procfs directly.

npm ci --ignore-scripts
npm run build
npm run typecheck
npm run format:check
npm test

CI builds and tests x64 and ARM64 binaries for macOS and Windows, then assembles the release tarball with npm run pack:release. Installing that package needs no compiler or install scripts. Linux reads procfs directly.

MIT