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

proxy-watch

v0.2.1

Published

The operating system's proxy settings, layered with *_proxy, and the route each URL takes under them, for Node.js

Readme

proxy-watch

The operating system's proxy settings for Node.js, layered with http_proxy, https_proxy, all_proxy and no_proxy, and the route each URL takes under them. Windows, macOS and Linux (GNOME, KDE) settings are read directly, not through a helper command.

npm install proxy-watch
const { readSync } = require('proxy-watch');

const snapshot = readSync(); // or `await read()`, which reads the OS on a libuv worker
const route = snapshot.route('https://example.com/');
if (route.kind === 'steps') {
  console.log(route.steps); // ['direct'] or proxy URLs, credentials included
} else {
  console.log(route.kind);  // 'pac', 'pac-inline' or 'wpad': the caller runs the script
}

snapshot.toJSON() gives the whole configuration as plain objects: the mode in effect, each proxy's host, port and credentials, the bypass rules, and every source's own mode. util.inspect masks passwords; toJSON() and JSON.stringify(snapshot) hold them.

PAC

route(url, { pac }) and routeAsync(url, { pac }) choose who runs a PAC configuration:

| pac | Engine | |---|---| | 'none' (default) | No engine: the route names the PAC URL, script or WPAD | | 'native' | The OS's engine (WinHTTP, CFNetwork), with real DNS | | 'quickjs' | QuickJS in this process, under policy | | 'auto' | The OS's engine where it has one for the mode, else QuickJS |

script runs a PAC body you fetched yourself, and wpad: true lets the OS discover one (Windows, macOS). route.engine says which engine answered. QuickJS's default policy answers as if off every network (myIpAddress() is 127.0.0.1 and dnsResolve answers null), so a script that picks a proxy by network needs a policy that says where the machine is. routeAsync runs on a libuv worker, so a download or a slow script does not block the event loop.

Watching

const { watchSync } = require('proxy-watch');

const watcher = watchSync((err, snapshot) => {
  if (err) console.error(err.code);
  else console.log(snapshot.route('https://example.com/').kind);
});
// later
watcher.close();

The watch does not keep the process alive.

Platforms

Prebuilt for Linux x64 and arm64 (glibc 2.17 and later, and musl), Linux arm (ARMv7, glibc 2.17 and later), macOS x64 and arm64, and Windows x64 and arm64. The loader picks the package that matches the machine.

License

MIT OR Apache-2.0. Each platform package carries THIRD-PARTY-LICENSES.txt for the Rust crates, the C sources and the Rust standard library linked into it.