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

beanstalkd-ts

v0.1.7

Published

Beanstalkd client with full typescript support. Extremely fast, lightweight and dependency-free.

Readme

Beanstalkd Client with full TypeScript support

STATUS: BETA. This library is still under heavy development. Do not use in production.

Installation:

npm install beanstalkd-ts

Usage:

import { BeanstalkdClient } from 'beanstalkd-ts'

const client = new BeanstalkdClient()

await client.connect()

await client.put("some payload")

const result = await client.reserveWithTimeout(10);

await client.deleteJob(result.jobId)

For the list of available commands, refer to the official beanstalkd manual: https://raw.githubusercontent.com/beanstalkd/beanstalkd/master/doc/protocol.txt

If you need to handle connection failures, you can use this method:

client.getConnection(); // returns Socket | null

Example worker with reserve timeout handling

import { BeanstalkdClient, BeanstalkdJob, TimedOutError } from 'beanstalkd-ts'

const client = new BeanstalkdClient();

for (;;) {
  try {
    const job: BeanstalkdJob = await this.bsClient.reserveWithTimeout(10);

    // process job...
    console.log('process job:', job.id, job.payload.toString())

    // remove from the queue
    await client.deleteJob(job.id)
  } catch (err) {
    if (err instanceof TimedOutError) {
      continue; // could not reserve a job in 10 seconds. retry again.
    }

    // rethrow the original error
    throw err;
  }
}

Features

  • All commands and their success results are typed. (OkResponse, InsertedResponse etc..)
  • All beanstalkd errors are typed through specific classes each (NotFoundError, ExpectedCrlfError, etc..)
  • Fully unit tested.
  • Throws errors with extra call stack (preserves original call stack)

Non-features

  • DOES NOT handle auto-reconnect. Thus you need to handle the "close" event. And issue your .use/.watch/.ignore calls right after the .connect call. You might want to stop the worker process and let process manager to wait for beanstalkd to become available.

Statistics

Server Stats

await client.stats()
export class ServerStats {
  readonly binlogCurrentIndex: number;
  readonly binlogMaxSize: number;
  readonly binlogOldestIndex: number;
  readonly bingloRecordsMigrated: number;
  readonly binlogRecordsWritten: number;
  readonly cmdBury: number;
  readonly cmdDelete: number;
  readonly cmdIgnore: number;
  readonly cmdKick: number;
  readonly cmdListTubeUsed: number;
  readonly cmdListTubesWatched: number;
  readonly cmdListTubes: number;
  readonly cmdPauseTube: number;
  readonly cmdPeekBuried: number;
  readonly cmdPeekDelayed: number;
  readonly cmdPeekReady: number;
  readonly cmdPeek: number;
  readonly cmdPut: number;
  readonly cmdRelease: number;
  readonly cmdReserveWithTimeout: number;
  readonly cmdReserve: number;
  readonly cmdStatsJob: number;
  readonly cmdStatsTube: number;
  readonly cmdStats: number;
  readonly cmdTouch: number;
  readonly cmdUse: number;
  readonly cmdWatch: number;
  readonly currentConnections: number;
  readonly currentJobsBuried: number;
  readonly currentJobsDelayed: number;
  readonly currentJobsReady: number;
  readonly currentJobsReserved: number;
  readonly currentJobsUrgent: number;
  readonly currentProducers: number;
  readonly currentTubes: number;
  readonly currentWaiting: number;
  readonly currentWorkers: number;
  readonly draining: string;
  readonly hostname: string;
  readonly id: string;
  readonly jobTimeouts: number;
  readonly maxJobSize: number;
  readonly os: string;
  readonly pid: number;
  readonly platform: string;
  readonly rusageStime: number;
  readonly rusageUtime: number;
  readonly totalConnections: number;
  readonly totalJobs: number;
  readonly uptime: number;
  readonly version: string;
}

Tube Stats

await client.statsTube('tube-name')
export class TubeStats {
  readonly name: string;

  readonly cmdDelete: number;
  readonly cmdPauseTube: number;
  readonly currentJobsBuried: number;
  readonly currentJobsDelayed: number;
  readonly currentJobsReady: number;
  readonly currentJobsReserved: number;
  readonly currentJobsUrgent: number;
  readonly currentUsing: number;
  readonly currentWaiting: number;
  readonly currentWatching: number;
  readonly pause: number;
  readonly pauseTimeLeft: number;
  readonly totalJobs: number;
}

Job Stats

await client.statsJob(123)
export class JobStats {
  readonly id: number;
  readonly tube: string;
  readonly state: string;

  readonly age: number;
  readonly buries: number;
  readonly delay: number;
  readonly file: number;
  readonly kicks: number;
  readonly pri: number;
  readonly releases: number;
  readonly reserves: number;
  readonly timeLeft: number;
  readonly timeouts: number;
  readonly ttr: number;
}