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 🙏

© 2024 – Pkg Stats / Ryan Hefner

atomic-queue

v5.0.4

Published

a crash friendly queue that persists queue state and can restart. uses a worker pool and has configurable concurrency

Downloads

47

Readme

atomic-queue

a crash friendly queue that persists queue state and can restart. uses a worker pool and has configurable concurrency

NPM

js-standard-style

API

for example usage see test.js

var queue = require('atomic-queue')(worker, opts)

initialize a new queue with a worker function and optional options. queue is a stream

you queue things by writing them to the queue stream:

queue.write('hello')
queue.write('goodbye')
queue.write({name: 'bob'})

worker must be a function that has this API:

function work (data, done) {
  // do work, then call done with (err) if there was an error
}

data in the worker function will be the data you wrote into the queue above

events

in addition to standard stream events you can also listen to the following:

queue.on('ready')

emitted after startup when the queue state has been read from disk and the queue is now ready to start working

queue.on('error')

when a catastrophic error has occurred. you must handle this. receiving this also means the queue stream has been destroyed.

queue.on('idle')

when the number of pending jobs reaches 0. may be called multiple times

queue.on('finish')

when the writable side of the queue has been ended and all jobs have finished processing

queue.on('update-start')

when the queue starts flushing its state to disk

queue.on('update-end')

when the queue finishes flushing its state to disk

queue.pool.on('start')

when a job starts working

queue.pool.on('finish')

when a job finishes working