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

redis-on-workers

v0.5.0

Published

Connect to your Redis server using cloudflare:sockets

Readme

redis-on-workers

Connect to your Redis server in Cloudflare Workers using cloudflare:sockets.

Use this package in Cloudflare Workers or Node.js with the cloudflare:sockets for Node.js implementation.

Installation

npm install redis-on-workers

Usage

The API has three methods: send, sendRaw, and close.

import { createRedis } from "redis-on-workers";

await using redis = createRedis("redis://<username>:<password>@<host>:<port>");

await redis.send("SET", "foo", "bar");

const value = await redis.send("GET", "foo");

console.log(value); // bar

await using closes the connection when the block ends. Without it, call redis.close() yourself.

Concurrent send calls share one connection. Each reply stays matched to its command.

Raw Uint8Array

sendRaw skips string decoding. Use it for binary data, such as protobuf messages.

const value = await redis.sendRaw("GET", "foo");

console.log(new TextDecoder().decode(value)); // bar

Error handling

A server error reply rejects its command with a RedisError. The connection stays open. A transport failure rejects with a plain Error and closes the connection.

import { RedisError } from "redis-on-workers";

try {
  await redis.send("MY_GO");
} catch (error) {
  if (error instanceof RedisError) console.log(error.message); // ERR unknown command 'MY_GO'
}

Node.js

Install the cloudflare:sockets Node.js polyfill:

npm install @arrowood.dev/socket

API

createRedis(options: RedisOptions | string): Redis

Create a Redis client. It connects when you send the first command.

  • redis.send(...command): send a command, decode bulk strings in the reply.
  • redis.sendRaw(...command): send a command, keep bulk strings as Uint8Array.
  • redis.close(): close the connection. The next send reconnects.

RedisOptions

  • url (string): The URL of the Redis server.
  • tls (boolean): Whether to use TLS. Defaults to true for rediss: URLs.
  • logger (function): A function to log debug messages.
  • connectFn (function): Polyfill for cloudflare:sockets's connect function if you're using it in node.js. Default: undefined.

License

MIT