1.0.0 • Published 7 months ago

network-speed-tester v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

Network Speed Tester

network-speed-tester is a lightweight package to measure network ping, upload, and download speeds.

Features

  • Ping Test: Measure network latency.
  • Download Speed Test: Simulate and measure download speed.
  • Upload Speed Test: Simulate and measure upload speed.

Installation

Install the package using NPM:

npm install network-speed-tester

Example of how to use the package:

1. First, import the required functions in your JavaScript or TypeScript file:

import { getPing, getDownloadSpeed, getUploadSpeed } from "network-speed-tester";

2. Then, use these functions to get the ping, download speed, and upload speed:

async function testNetworkSpeed() {
  const ping = await getPing(); // Get the ping value
  console.log("Ping:", ping); // Output the ping

  const downloadSpeed = await getDownloadSpeed(); // Get the download speed
  console.log("Download Speed:", downloadSpeed); // Output the download speed

  const uploadSpeed = await getUploadSpeed(); // Get the upload speed
  console.log("Upload Speed:", uploadSpeed); // Output the upload speed
}

testNetworkSpeed(); // Call the function to test the network speed

To start the server, run the following command:

npx network-speed-tester

By default, the server will start on http://localhost:3000. You can use the following endpoints:

Ping Test: GET /api/ping
Download Speed Test: GET /api/download
Upload Speed Test: POST /api/upload
1.0.0

7 months ago