该介绍目前仅提供英文版本。
Overview
@cloudflare/speedtest is a JavaScript module that measures the quality of a client’s internet connection. It is the measurement engine behind Cloudflare’s own speed test at speed.cloudflare.com.
How it works
The module sends test requests to the Cloudflare edge network and reads timing data from the browser’s PerformanceResourceTiming API. It characterizes a connection by:
- Download and upload bandwidth
- Latency
- Packet loss
Install
npm install @cloudflare/speedtest
Note that Cloudflare collects the measurement results when a test completes; see the README for details and how results are used.