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

@b9g/node-webworker

v0.1.3

Published

Minimal Web Worker shim for Node.js until native support arrives

Readme

@b9g/node-webworker

Minimal Web Worker shim for Node.js until native support arrives.

Why This Package Exists

Node.js lacks native Web Worker support, despite being a web standard since 2009. This package provides a minimal, reliable shim using Node.js worker_threads until native support is added.

🔗 Canonical Issue: https://github.com/nodejs/node/issues/43583 Please 👍 and comment on the issue to show demand for native Web Worker support!

Installation

npm install @b9g/node-webworker

Usage

import { Worker } from '@b9g/node-webworker';

// Create a worker (same API as Web Workers)
const worker = new Worker('./worker.js', { type: 'module' });

// Listen for messages
worker.addEventListener('message', (event) => {
  console.log('Received:', event.data);
});

// Send a message
worker.postMessage({ hello: 'world' });

// Terminate when done
await worker.terminate();

Exports

Classes

  • Worker - Web Worker implementation using Node.js worker_threads

Types

  • MessageEvent - Event type for worker messages
  • ErrorEvent - Event type for worker errors

Default Export

  • Worker - The Worker class

Features

  • Standards-compliant API - Drop-in replacement for Web Workers
  • ES Module support - Works with modern JavaScript
  • Minimal overhead - Thin wrapper around worker_threads
  • Error handling - Proper event forwarding
  • Clean termination - Resource cleanup

Limitations

  • Transferable objects - Limited support (logs warning)
  • Node.js only - Don't use this in browsers (they have native Web Workers)
  • Basic API - Only core Worker features, not full spec

Deprecation Notice

⚠️ This package will be deprecated once Node.js implements native Web Workers.

We maintain this as a temporary workaround. Please help push for native support by engaging with nodejs/node#43583.

License

MIT