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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@onlyrex/pulse

v1.0.5

Published

⚡ Pulse — blazing-fast, browser-native internet speed tester using fetch streams.

Readme


🚀 What is Pulse?

Pulse is a modern internet speed test tool for web apps. Inspired by tools like Fast.com, it uses parallel fetch streams, live speed updates, and no external dependencies to measure your actual network bandwidth directly from the browser.

Built for:


🧠 How It Works

Pulse runs the test in 3 stages:

  1. Ping Test: Sends multiple HEAD requests to a server to calculate average response time (latency).
  2. Download Test: Fires 8 parallel fetch() streams to download random data, calculating the bitrate in real time.
  3. Upload Test: Generates a binary blob and uploads it to a public endpoint (like httpbin.org) to simulate an upload session.

Everything runs client-side only — no backend needed.


🧠 Summary

| Method | Shows Live Progress? | Final Result? | | ------------------------------ | -------------------- | ------------- | | runSpeedTest() | ❌ No | ✅ Yes | | testPing() | ❌ No | ✅ Yes | | testDownload({ onProgress }) | ✅ Yes | ✅ Yes | | testUpload({ onProgress }) | ✅ Yes | ✅ Yes |


  • Runs all 3 tests and returns the final results.

📦 Installation

npm install @onlyrex/pulse

📘 API Reference

Vanilla JS

runSpeedTest(options?) → Promise<{ ping, download, upload }>

  • Runs all 3 tests — ping, download, and upload — and returns final results.
  • It internally calls testPing, testDownload, and testUpload without exposing their real-time progress.
import { runSpeedTest } from '@onlyrex/pulse';

const result = await runSpeedTest();
console.log(result);

// result → { ping: "16.87", download: "74.21", upload: "9.45" }

Unless you want real-time progress you have to pass a callback like onProgress to testDownload() or testUpload()

testPing(url?: string, count?: number): Promise<string>

  • Measures average latency using multiple HEAD requests.
  • url: Optional ping target (default: google.com)
  • count: Number of ping attempts (default: 5)

testDownload({ durationSeconds = 15, url, onProgress }): Promise<string>

  • Performs 8 parallel fetches and measures speed.
  • durationSeconds: Duration in seconds (default: 15 Seconds)
  • url: Optional download target
  • onProgress: Callback for live Mbps updates

testUpload({ sizeMB = 10, url, onProgress }): Promise<string>

  • Streams binary data via POST to test upload bandwidth.
  • sizeMB: File size in MB
  • url: Upload endpoint
  • onProgress: Callback for live Mbps updates
import { testPing, testDownload, testUpload } from '@onlyrex/pulse';

(async () => {
  const ping = await testPing();
  console.log(`Ping: ${ping} ms`);

  const download = await testDownload({
    onProgress: (mbps) => console.log(`Download: ${mbps} Mbps`),
  });

  console.log(`Final Download: ${download} Mbps`);

  const upload = await testUpload({
    onProgress: (mbps) => console.log(`Upload: ${mbps} Mbps`),
  });

  console.log(`Final Upload: ${upload} Mbps`);
})();

Angular

🔧 pulse-comp.component.ts

import { Component } from '@angular/core';
import { testPing, testDownload, testUpload } from '@onlyrex/pulse';

@Component({
  selector: 'app-pulse-comp',
  standalone: true,
  imports: [],
  templateUrl: './pulse-comp.html',
  styleUrls: ['./pulse-comp.css'] 
})
export class PulseComp {
  ping: string = '0.00';
  download: string = '0.00';
  upload: string = '0.00';
  loading: boolean = false;

  async runTest() {
    this.loading = true;

    try {
      const pingResult = await testPing();
      this.ping = pingResult.ping.toFixed(2);

      this.download = '0.00';
      await testDownload({
        durationSeconds: 10,
        onProgress: (mbps: string) => {
          this.download = parseFloat(mbps).toFixed(2);
        },
      });

      this.upload = '0.00';
      await testUpload({
        durationSeconds: 10,
        onProgress: (mbps: string) => {
          this.upload = parseFloat(mbps).toFixed(2);
        },
      });

    } catch (error) {
      console.error('Speed test failed:', error);
      this.ping = this.download = this.upload = 'Error';
    } finally {
      this.loading = false;
    }
  }
}