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

osc-progress

v0.3.3

Published

Tiny TypeScript helper for OSC 9;4 terminal progress sequences.

Downloads

842,633

Readme

osc-progress ⏳ — Tiny progress, right in the tab.

CI npm Node License

osc-progress is a TypeScript library for emitting and removing OSC 9;4 terminal progress sequences. It is intended for Node.js CLIs running in Ghostty, WezTerm, Canario, or Windows Terminal and becomes a no-op outside supported TTYs.

Install

pnpm add osc-progress

Node.js 24 or newer is required.

Quick start

import { setTimeout as delay } from "node:timers/promises";
import { startOscProgress } from "osc-progress";

const stop = startOscProgress({ label: "Indexing", indeterminate: true });
try {
  await delay(1_000);
} finally {
  stop();
}

startOscProgress() writes to stderr by default. In a supported terminal it starts progress and returns an idempotent function that clears it; elsewhere both operations do nothing.

Report real progress

Use a controller when the work already exposes a percentage or moves between states:

import { createOscProgressController } from "osc-progress";

const progress = createOscProgressController({ stallAfterMs: 10_000 });
progress.setIndeterminate("Connecting");
progress.setPercent("Downloading", 42);
progress.done();

Updates are deduplicated and throttled to about one every 150 ms. Percentages are rounded and clamped to 0..100; done() and fail() emit their final state before clearing it.

Detection and overrides

Progress is enabled only for a TTY recognized as Ghostty, WezTerm, Canario, or Windows Terminal. The same detection applies to both startOscProgress() and createOscProgressController().

import { supportsOscProgress } from "osc-progress";

const supported = supportsOscProgress(process.env, process.stderr.isTTY === true, {
  forceEnvVar: "MY_CLI_FORCE_PROGRESS",
  disableEnvVar: "MY_CLI_NO_PROGRESS",
});

The named environment variables take effect when their value is "1". Direct force and disabled options are also available; a non-TTY stream always remains disabled.

Clean stored output

Remove progress control sequences before saving captured terminal output:

import { sanitizeOscProgress } from "osc-progress";

function prepareForStorage(output: string): string {
  return sanitizeOscProgress(output, process.stdout.isTTY === true);
}

The parser recognizes sequences terminated by BEL, ST (ESC \\), or C1 ST (0x9c).

API and terminal behavior

The public API includes the timer-based helper, a stateful controller, support detection, label sanitization, sequence discovery, and stripping helpers. See the API reference for signatures, options, exported constants, and OSC 9;4 portability notes.

OSC 9;4 state 4 is interpreted as paused by some terminals and warning by others. The library emits the numeric state without trying to normalize that terminal-specific behavior. Labels are an extra payload outside the canonical OSC 9;4 fields, so terminals may ignore them.

Development

pnpm install
pnpm build
pnpm test
pnpm check

pnpm check runs formatting, linting, typechecking, tests, and coverage thresholds.

License

MIT. See LICENSE.