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

workerify

v1.1.0

Published

Transform web workers into browserified inline Blobs with browserify.

Readme

workerify

Transform web workers into browserified inline Blobs with browserify.

browser support

example

Your entry point main.js:

var mod = require('module')
var worker = new Worker('worker.js')

Your worker entry point worker.js:

self.onmessage = function(e) {
  var ab = new Uint8Array(10)
  for (var n = 0; n < ab.length; n++) ab[n] = 1
  self.postMessage(ab.buffer, [ab.buffer])
}

Browserify with this workerify transform:

browserify -t workerify main.js > bundle.js

and your bundle.js will look like:

var mod = require('module')
var worker = new Worker(window.URL.createObjectURL(new Blob(['BROWSERIFIED CONTENTS OF worker.js'])));

further example

Take a look at the example module for using with workerstream.

Modular Workers

The main reason for this is modular workers.

Let's say you create a module that would like to use web workers. Users would need to configure the URL to the worker. When your module becomes a dependency of a dependency and so on, the setup becomes really cumbersome. Especially when your worker needs to be browserified.

With this transform you simply npm install workerify --save and configure your module's package.json to apply the transform:

{
  "name": "mymodule",
  "browserify": {
    "transform": "workerify"
  }
}

Now when end users browserify your module, anywhere in the dependency tree, it will browserify and inline the worker. No URLs, no extra build steps and no additional end user requirements.

Notes

Currently it will transform the following:

// String literal
new Worker('./path/to/worker.js')

// Variable Init Earlier
var myworker = './path/to/worker.js'
new Worker(myworker)

// Or specify the workerify keyword to browserify a string anywhere
// Useful if you want to inline your worker when working with other libs
var myworker = workerify './path/to/worker.js'
var workerstream = require('workerstream')(myworker)

Using with coffeescript

browserify file.coffee -t coffeeify -t workerify

install

With npm do:

npm install workerify

release history

  • 1.1.0 - Support for Workers as modules (@moin-qidwai).
  • 1.0.0 - Upgrade browserify to 14.0.0 (@runn1ng) and other deps. Prefer window.URL over window.webkitURL.
  • 0.3.0 - Upgrade browserify to 3.41.0. Allow worker to be used with watchify (@tmpvar)
  • 0.2.3 - support compilation from coffeescript original source file
  • 0.2.2 - string-escape dep renamed to jsesc (@mathiasbynens)
  • 0.2.1 - Add missing falafel dep and bug fixes (@mikolalysenko)
  • 0.2.0 - use falafel and support more formats
  • 0.1.0 - initial release

license

Copyright (c) 2017 Kyle Robinson Young Licensed under the MIT license.