Complete API reference for the Results class — accessed via engine.results or the onFinish callback — with all bandwidth, latency, packet loss, and AIM score methods.
Results accumulates measurement data as the engine runs and exposes typed accessor methods for every metric. You can read from it at any time during a test run — methods return undefined (or an empty array) when the relevant measurement has not yet started.
import SpeedTest from '@cloudflare/speedtest';import type { Results } from '@cloudflare/speedtest';// Access during a runconst engine = new SpeedTest();const bw = engine.results.getDownloadBandwidth(); // number | undefined// Access on completionengine.onFinish = (results: Results) => { console.log(results.getSummary());};
true when every measurement in the configured sequence has completed and the
results are final. Equivalent to SpeedTestEngine.isFinished. Use this to
gate calls to getScores(), which requires all measurements to be done.
if (engine.results.isFinished) { console.log(engine.results.getScores());}
Returns a single object aggregating every available metric. Keys are only present when their corresponding measurement was included in the measurement sequence and produced a result. All values are in native units: bps for bandwidth, ms for latency and jitter, and a ratio between 0 and 1 for packet loss.
All bandwidth values are in bits per second (bps). The single reduced value is the configured percentile of qualifying measurements (default: 90th percentile, set by bandwidthPercentile). Only measurements whose request duration exceeded bandwidthMinRequestDuration (default: 10 ms) are included.
To convert bps to Mbps, divide by 1e6. To convert to Kbps, divide by 1e3.
All latency and jitter values are in milliseconds. The single reduced value is the configured percentile of all samples (default: median, set by latencyPercentile).
Returns the round-trip latency at idle. Measured by dedicated latency-type requests to the download API with bytes=0. Returns undefined if no latency measurement has started.
Returns the jitter at idle, calculated as the average absolute difference between consecutive latency samples. Requires at least two latency measurements; returns undefined otherwise.
Returns the latency observed while the connection is saturated with download traffic. Only includes samples from requests that lasted longer than loadedRequestMinDuration (default: 250 ms). Requires measureDownloadLoadedLatency: true (default).
Returns all raw loaded-latency samples from the download phase. Capped at loadedLatencyMaxPoints (default: 20); when more samples are available, the most recent ones are kept as they are considered most accurate.
Loaded latency is typically higher than unloaded latency. The difference between the two (loaded latency increase) feeds directly into AIM score calculations — a large increase under load indicates bufferbloat.
Packet loss requires a WebRTC TURN server. You must provide your own TURN credentials — the public Cloudflare TURN server is deprecated. See Packet loss for setup instructions.
Returns the packet loss ratio as a number between 0 and 1. Multiply by 100 for a percentage. Returns undefined if no packetLoss measurement was configured or has not yet started.
Returns AIM (Aggregated Internet Measurement) scores that classify the network connection quality per use case (for example, streaming, gaming, or video calling). The score object is keyed by use case name.
Aggregate score for this use case derived from relevant metrics (download, upload, latency, loaded latency increase, and packet loss). Higher is better.
Human-readable label for the classification index.
getScores() only returns meaningful results after isFinished is true. Calling it mid-run returns scores based on partial data, which may not reflect the final connection quality.