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

durable-stream-client

v1.0.0-beta

Published

Client application for durable-stream

Readme

Durable Stream Client :electric_plug:

A lightweight client for Durable Stream

The client

Installation

npm install durable-stream-client

Feaures

  • Publish messages to a durable stream (to be propagated to other clients subscribed on the same subject)
  • Simple reconnect logic
  • Queues up messages while disconnected and sends them when reconnected (with a ~2 second timeout)
  • Subscribe to messages on a durable stream
  • Delete messages from a durable stream
  • Get/set the object state (a generic object we can set/get on the durable object)
  • Get metadata, get, put, delete objects in R2

Usage

// Shim the websocket client for node
globalThis.WebSocket = require('websocket').w3cwebsocket;

import DurableStreamClient from 'durable-stream-client'

const client = new DurableStreamClient({
  host: '<worker-name>.voxo.workers.dev', // defaults to localhost:8787
  secure: true, // boolean required (if local set to false)
  apiKey: 'my-api-key', // string required
  subject: 'my-subject', // string required
})

// Initialize the client
await client.init();

Primary Stream Methods

// Get the current sequence number and general stream info
const info = await client.info();
console.log(info);

const msg = {
  test: 'value',
  someData: 'some-data',
}

// Publish a message (can be a string or object)
const res = await client.publish(msg)
// Returns a promise that resolves to the response from the server and includes the message id, sequence number etc..

// Subscribe to messages
// The first arg is the sequence number to start from (0 for all messages from the beginning of the stream)
client.subscribe(10000000019, async (msg, ack) => {
  console.log(`Received message: ${JSON.stringify(msg)}`);
  ack();
  // Be sure to ack all messages!
  // Acknowledging a message will remove it from the queue on the client and server
})

// Unsubscribe from messages
await client.unsubscribe();

// Delete messages in the stream up to a sequence number
await client.delete(10000000019);

// Get the object object state (just a generic object we can set/get on the durable object)
const state = await client.getState();

// Set the object state
await client.putState({ some: 'data' });

R2 Methods

// Head object (get metadata)
const metadata = await client.headObject('/path/to/object.ext');

// Get object
const object = await client.getObject('/path/to/object.ext');
// Write the file to disk
fs.writeFileSync('/local/path/file.ext', object);

// Put object
// Arg 1 = file path in R2
// Arg 2 = local file path to upload

const res = await client.putObject('/path/to/object.ext', '/local/path/file.ext');

// Delete object
const res = await client.deleteObject('/path/to/object.ext');

License

MIT