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

@enk0ded/watcher

v0.4.0

Published

A high-performance file system watcher for Node.js, written in Rust and exposed via N-API bindings

Readme

@enk0ded/watcher

CI

A high-performance file system watcher for Node.js, written in Rust and exposed via N-API bindings.

Features

  • High Performance: Uses native OS APIs (inotify on Linux, FSEvents on macOS, ReadDirectoryChangesW on Windows)
  • Cross-Platform: Works on Linux, macOS, and Windows
  • Event Debouncing: Built-in debouncing to coalesce rapid file system changes
  • Glob Pattern Support: Flexible ignore patterns using glob syntax
  • Recursive Watching: Automatically watches all subdirectories
  • TypeScript First: Full TypeScript support with comprehensive type definitions

Installation

bun add @enk0ded/watcher

Usage

import { subscribe } from '@enk0ded/watcher';

// Start watching a directory
const subscription = subscribe(
  '/path/to/watch',
  ({ error, events }) => {
    if (error) {
      console.error('Watch error:', error);
      return;
    }

    for (const event of events) {
      console.log(`${event.type}: ${event.path}`);
    }
  },
  { ignore: ['node_modules', '*.log', '.git/**'] },
);

// Later, stop watching
subscription.unsubscribe();

API

subscribe(directory, callback, options?)

Subscribes to file system changes in a directory.

Parameters

  • directory (string): The directory path to watch (must exist and be a directory)
  • callback (({ error, events }: { error?: Error; events: Event[] }) => void): Function called when changes occur
  • options (Options, optional): Configuration options
    • ignore (string[], optional): Patterns to ignore (file paths or glob patterns)

Returns

Promise<Subscription>: A subscription object with an unsubscribe() method.

Event Types

type WatchEvent = {
  path: string; // Absolute path to the changed file/directory
  type: 'create' | 'update' | 'delete'; // Type of change
};

Development

Prerequisites

  • Bun >= 1.3.5
  • Rust >= 1.92.0
  • Node.js >= 24

Building

After bun run build command, you can see a watcher.[darwin|win32|linux].node file in project root. This is the native addon built from lib.rs.

# Install dependencies
bun install

# Build
bun run build

# Build in debug mode
bun dev

Testing

This package uses Bun's built in Test runner.

bun test

CI

With GitHub Actions, each commit and pull request will be built and tested automatically in [node@24] x [macOS, Linux, Windows] matrix.

Release

The release action of this package releases multiple NPM packages for different platforms and adds them to optionalDependencies before releasing the main package.

Your package manager will choose which native package it should install automatically. You can take a look at the npm directory for details.

Performance

This watcher is optimized for performance:

  • Uses OS-native file watching APIs
  • Events are debounced (100ms default) to reduce callback overhead
  • Glob patterns are pre-compiled at subscription time
  • Zero-copy event handling in Rust
  • Efficient thread communication via crossbeam channels

Release package

Ensure you have set your NPM_TOKEN in the GitHub project setting.

In Settings -> Secrets, add NPM_TOKEN into it.

When you want to release the package:

npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git]

git push

GitHub actions will do the rest job for you.

WARN: Don't run npm publish manually.