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

@wringer/stream

v0.1.2

Published

The stream driver for wringer: records a target's logs during a run and reads them from a cursor

Readme

The stream driver for wringer: it records a target's logs for the whole run, and reads them back from a cursor.

Install

bun add @wringer/core @wringer/stream

The package runs on Bun 1.3 or newer.

Usage

import { createWringer, ssh } from '@wringer/core';
import { stream } from '@wringer/stream';

export const registry = createWringer({ name: 'shop' })
  .use(stream({}))
  .target('staging', {
    mode: 'attach',
    access: 'read-only',
    host: ssh({ destination: '[email protected]' }),
    drivers: {
      stream: () => ({
        sources: { jobs: { command: ['journalctl', '-f', '-u', 'shop-jobs', '-o', 'cat'] } },
      }),
    },
  })
  .build();

An action calls ctx.drivers.stream.read({ name, from }). The CLI adds stream read <name>, and the doctor check stream.recording, which fails when a source has stopped or its records fail to write.

Sources

  • { command: [...] } runs the command on the target's host and records each line it prints. At the stop, the recorder reads on until the command prints nothing for 200 ms, for at most 2 s, then kills it.
  • { file: '<path>' } follows a file on the machine where the run lives. The supervisor stops the app first, then reads the file to its end, so the lines the app logs while it shuts down are recorded.
  • On an attach target, the run owns no app, so the recorder stops without waiting for one. A line the app writes after the recorder's final read stays out of the stream.
  • A target with no sources records app: the log of the app that the run launched.

The run's supervisor writes each source to streams/<name>.ndjson in the run folder, one { at, line } record per line. A record keeps at most 4096 characters of its line. When a source logs faster than the disk takes it, the supervisor holds at most 10,000 pending records per source, plus the batch it is writing. It drops the rest, and then writes a record that counts the dropped lines. A batch that fails to write stays queued for the next write, and the source reads as failed until a write succeeds. When the run stops with records still unwritten, or with a source it could not read, the run ends as crashed, and its crash reason names the stream and the error. The down or detach that stopped the run then fails with an environment error that names them too.

Cursors

A cursor is a byte offset into a stream's file. use marks the end of each stream, and every envelope holds the current ends in cursors.

  • A read with no from starts at the cursor that use last marked, so it returns only what was logged since.
  • A read returns the records up to the maxBytes option, 64 KiB by default, with the next cursor and more when the stream holds more. A read may pass a smaller maxBytes, down to 32 KiB.
  • A cursor past the end of the file belongs to an older run, so the read starts over at 0.