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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@webreflection/json-watch

v0.1.3

Published

A Proxy based alternative to json-watch module

Readme

@webreflection/json-watch

build status Coverage Status

Social Media Photo by Andrik Langfield on Unsplash

A modern take at this 7yo json-watch module.

import watcher from '@webreflection/json-watch';

// returns a Proxy for an arrow function
const json = watcher('/path/to/file.json');
// {"any":"data"} as file content example

// the object reads the file only when accessed
// and only if there were no changes in between reads
json.any === 'data'; // true

// setting arbitrary data is OK too
json.other = 'stuff';

// but no write happens out of the box, however
// it is always possible to save the file again
import {writeFile} from 'node:fs';
writeFile('/path/to/file.json', JSON.stringify(json), _ => {
  // once written, all other watchers will have the latest
  // written version of the JSON object content
  console.log(json.other); // "stuff"
});

The default export watcher(path[, options]) accepts an optional object to configure the watch(path, options) node operation.

By default, the options object contains {persistent: false}. All options for watch are available.

What are the differences compared to the old module?

  • multiple paths can be observerd, not just one per time
  • the first read is lazy
  • Proxy is (imho) a better DX for this kind of utility / use case
  • the amount of consumed memory is fine-tuned to the minumum
  • the JSON can contain single line comments which, even if not allowed by specs, is practical for settings.json like config files and entries description (meaning, the .json file can also be a parsable .js file that preserve other .json rules)
  • it has 100% code coverage
  • it's a dual ESM / CJS module