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

@staffetta/client

v0.2.0

Published

Client engine of the staffetta speedtest: runs the ping → download → upload relay against any server implementing the protocol. Framework-free, fetch-based.

Readme

@staffetta/client

Client engine of the staffetta speedtest: runs the ping → download → upload relay against any server implementing the protocol (reference implementation: @staffetta/server). Framework-free, fetch-based — runs in browsers and Node.

Install

npm install @staffetta/client

Usage

import {runSpeedtest} from '@staffetta/client'

const result = await runSpeedtest({
  baseUrl: 'https://api.example.com',
  headers: () => ({authorization: `Bearer ${getToken()}`}), // resolved before each request
  signal: abortController.signal,
  onPhase: phase => console.log(`— ${phase}`),
  onSample: sample => console.log(sample),
})

// result: {timestamp, target,
//          latency: {avgMs, minMs, maxMs, p50Ms, p90Ms, jitterMs},
//          download: {avgMbps, minMbps, maxMbps, p50Mbps, p90Mbps, stabilityCv}, upload: {…},
//          loadedLatency: {download: {…}, upload: {…}, bufferbloatMs},
//          verdict: 'optimal' | 'good' | 'unstable' | 'critical'}

Tune the run with config and the verdict with thresholds; defaults live in @staffetta/core:

config: {
  pingCount: 16,                          // measured pings (plus a discarded warm-up)
  transferDurationMs: 8000,               // target duration of each transfer phase
  warmupMs: 1000,                         // minimum warm-up excluded from the stats (it extends adaptively until steady state)
  initialRequestSizeBytes: 262_144,       // first request of the adaptive size ramp (256 KiB)
  maxRequestSizeBytes: 67_108_864,        // ramp cap (64 MiB) — keep it under the server's maxSizeBytes
  connections: 3,                         // parallel streams per transfer phase
  loadedPingIntervalMs: 250,              // latency probes under load; 0 disables loadedLatency
  sampleIntervalMs: 250,                  // throughput sampling window
  phaseTimeoutMs: 120_000,                // safety timeout per phase
}

Timeouts keep what they measured. When a phase's safety timeout fires, runSpeedtest rejects with SpeedtestTimeoutError, whose partial field carries the completed phases plus whatever the interrupted phase collected — enough to see that ping and download were fine and the upload is what hangs.

Latency under load (bufferbloat). While download and upload run, the client keeps probing the ping endpoint; loadedLatency reports the RTT stats per direction plus bufferbloatMs, and the verdict accounts for it.

Full methodology (parallel streams, adaptive size ramp, request overlap, warm-up handling) and protocol spec: github.com/staffetta/staffetta. React bindings: @staffetta/react.

License

MIT