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

thunk-disque

v0.5.13

Published

A thunk/promise-based disque client.

Downloads

32

Readme

thunk-disque

A thunk/promise-based disque client, support all disque features.

NPM version Build Status Downloads js-standard-style

Features

  • Auto meet nodes to cluster
  • Auto connect available nodes on demand
  • Auto select connection by jobId

中文教程 http://disquebook.com/

https://github.com/antirez/disque

https://github.com/thunks/thunks

Installation

Node.js:

npm install thunk-disque

Demo

var disque = require('thunk-disque')
var client = disque.createClient([7711, 7712, 7713])
var clientP = disque.createClient([7711, 7712, 7713], {usePromise: true})

// thunk API
client.info()(function (err, info) {
  console.log(err, info)

  return this.addjob('queueA', 'Hello', 0)
})(function (err, res) {
  console.log(err, res)
  // null
  // 'DI81250b3ccbac68e6625e79c8e7c5b286b1dcd2ac05a0SQ'
  return this.show(res)

})(function (err, res) {
  console.log(err, res)
  // null
  // {
  //   id: 'DI81250b3ccbac68e6625e79c8e7c5b286b1dcd2ac05a0SQ',
  //   queue: 'queueA',
  //   state: 'queued',
  //   repl: 3,
  //   ttl: 86400,
  //   ctime: 1430579357544000000,
  //   delay: 0,
  //   retry: 8640,
  //   'nodes-delivered':
  //    [ 'f0e652056250c887ed294a53fa9386ea05abb0be',
  //      '2067c69f914c619ed9f348f5ce6e7532ec26e9a8',
  //      '81250b3c4318f0b6463da3742c7cf7069a46b6f6' ],
  //   'nodes-confirmed': [],
  //   'next-requeue-within': 8639835,
  //   'next-awake-within': 8639335,
  //   body: 'Hello'
  // }
  return this.clientEnd()
});

// promise API
clientP.info()
  .then(function (info) {
    console.log(info)

    return clientP.addjob('queueA', 'Hello', 0)
  })
  .then(function (res) {
    console.log(res)
    // 'DI81250b3ccbac68e6625e79c8e7c5b286b1dcd2ac05a0SQ'
    return clientP.show(res)

  })
  .then(function (res) {
    console.log(res)
    // {
    //   id: 'DI81250b3ccbac68e6625e79c8e7c5b286b1dcd2ac05a0SQ',
    //   queue: 'queueA',
    //   state: 'queued',
    //   repl: 3,
    //   ttl: 86400,
    //   ctime: 1430579357544000000,
    //   delay: 0,
    //   retry: 8640,
    //   'nodes-delivered':
    //    [ 'f0e652056250c887ed294a53fa9386ea05abb0be',
    //      '2067c69f914c619ed9f348f5ce6e7532ec26e9a8',
    //      '81250b3c4318f0b6463da3742c7cf7069a46b6f6' ],
    //   'nodes-confirmed': [],
    //   'next-requeue-within': 8639835,
    //   'next-awake-within': 8639335,
    //   body: 'Hello'
    // }
  })
  .catch(function (err) {
    console.error(err)
  })

API

var disque = require('thunk-disque')

disque.createClient([port], [host], [options])

disque.createClient([addressArray], [options])

  • port: {Number}, default: 7711;
  • host: {String}, default: '127.0.0.1';
  • options: {Object}, default: {};
    • handleError: {Boolean}, Optional, Handle client error event. Default: true.

    • authPass: {String}, Optional, Default: ''.

    • autoMeet: {Boolean}, Optional, Default: false.

    • returnBuffers: {Boolean}, Optional, Default: false.

    • usePromise: {Boolean|Promise}, Optional, Default: false.

      Use default Promise:

      var disque = require('thunk-disque')
      var client = disque.createClient({
        usePromise: true
      })

      Use bluebird:

      var disque = require('thunk-disque')
      var Bluebird = require('bluebird')
      var client = disque.createClient({
        usePromise: Bluebird
      })
    • noDelay: {Boolean}, Optional, Default: true. Disables the Nagle algorithm. By default TCP connections use the Nagle algorithm, they buffer data before sending it off. Setting true for noDelay will immediately fire off data each time socket.write() is called.

    • retryMaxDelay: {Number}, Optional, Default: Infinity. By default every time the client tries to connect and fails time before reconnection (delay) almost multiply by 1.2. This delay normally grows infinitely, but setting retryMaxDelay limits delay to maximum value, provided in milliseconds.

    • maxAttempts: {Number}, Optional, Default: 10. By default client will try reconnecting until connected. Setting maxAttempts limits total amount of reconnects.

Create a disque client, return the client.

// connect to 127.0.0.1:7711
var client1 = disque.createClient()
var client2 = disque.createClient(7711, '127.0.0.1')

// connect to 127.0.0.1:7711, 127.0.0.1:7712
// and auto meet them into cluster
var client3 = redis.createClient([7711, 7712], {autoMeet: true})
var client4 = redis.createClient(['127.0.0.1:7711', '127.0.0.1:7712'], {autoMeet: true}) // IPv4
var client5 = redis.createClient(['[::1]:7711', '[::1]:7712'], {autoMeet: true}) // IPv6

disque.log([...])

var client = disque.createClient()
client.info()(redis.log)

Events

client.on('close', function () {})

client.on('connect', function () {})

client.on('connection', function (connection) {})

client.on('warn', function (error) {})

client.on('error', function (error) {})

client.on('reconnecting', function (message) {})

client.on('monitor', function (message) {})

Others

client.clientCommands

client.clientEnd()

client.clientUnref()

Disque Commands

client.ackjob

client.addjob

client.auth

client.bgrewriteaof

client.client

client.cluster

client.command

client.config

client.debug

client.deljob

client.dequeue

client.enqueue

client.fastack

client.getjob

client.hello

client.info

client.latency

client.loadjob

client.monitor

client.ping

client.qlen

client.qpeek

client.show

client.shutdown

client.slowlog

client.time