Skip to main content
getSummary() is a convenience method that aggregates every available metric into a single plain object. It calls the same underlying getters as the individual methods (getDownloadBandwidth(), getUnloadedLatency(), etc.) and omits any key whose measurement was not performed or has not yet produced a result.

Return value

{
  download?:          number,  // bps
  upload?:            number,  // bps
  latency?:           number,  // ms
  jitter?:            number,  // ms
  downLoadedLatency?: number,  // ms
  downLoadedJitter?:  number,  // ms
  upLoadedLatency?:   number,  // ms
  upLoadedJitter?:    number,  // ms
  packetLoss?:        number,  // 0–1 ratio
}
All keys are optional. A key is present only when its measurement was included in the configured sequence and has returned a value.
download
number
Download bandwidth in bits per second. Divide by 1e6 to convert to Mbps.
upload
number
Upload bandwidth in bits per second. Divide by 1e6 to convert to Mbps.
latency
number
Unloaded (idle) latency in milliseconds, at the configured percentile (default: median).
jitter
number
Unloaded jitter in milliseconds — average absolute difference between consecutive latency samples.
downLoadedLatency
number
Latency measured while the connection is saturated with download traffic, in ms. Only present when measureDownloadLoadedLatency is enabled (default: true).
downLoadedJitter
number
Jitter during active download load, in ms.
upLoadedLatency
number
Latency measured while the connection is saturated with upload traffic, in ms. Only present when measureUploadLoadedLatency is enabled (default: true).
upLoadedJitter
number
Jitter during active upload load, in ms.
packetLoss
number
Packet loss ratio between 0 (no loss) and 1 (100% loss). Only present when a packetLoss measurement was configured and a TURN server was reachable.

Basic usage

import SpeedTest from '@cloudflare/speedtest';

new SpeedTest().onFinish = results => {
  console.log(results.getSummary());
};
Example output:
{
  "download": 94500000,
  "upload": 21300000,
  "latency": 12,
  "jitter": 1.4,
  "downLoadedLatency": 38,
  "downLoadedJitter": 4.2,
  "upLoadedLatency": 29,
  "upLoadedJitter": 3.1,
  "packetLoss": 0
}

Formatting values for display

Raw values use base units (bps, ms, ratio). Here is a helper that formats each field for display:
function formatSummary(summary) {
  const fmt = {};

  if (summary.download !== undefined)
    fmt.download = `${(summary.download / 1e6).toFixed(1)} Mbps`;

  if (summary.upload !== undefined)
    fmt.upload = `${(summary.upload / 1e6).toFixed(1)} Mbps`;

  if (summary.latency !== undefined)
    fmt.latency = `${summary.latency.toFixed(1)} ms`;

  if (summary.jitter !== undefined)
    fmt.jitter = `${summary.jitter.toFixed(1)} ms`;

  if (summary.downLoadedLatency !== undefined)
    fmt.downLoadedLatency = `${summary.downLoadedLatency.toFixed(1)} ms`;

  if (summary.downLoadedJitter !== undefined)
    fmt.downLoadedJitter = `${summary.downLoadedJitter.toFixed(1)} ms`;

  if (summary.upLoadedLatency !== undefined)
    fmt.upLoadedLatency = `${summary.upLoadedLatency.toFixed(1)} ms`;

  if (summary.upLoadedJitter !== undefined)
    fmt.upLoadedJitter = `${summary.upLoadedJitter.toFixed(1)} ms`;

  if (summary.packetLoss !== undefined)
    fmt.packetLoss = `${(summary.packetLoss * 100).toFixed(2)}%`;

  return fmt;
}

new SpeedTest().onFinish = results => {
  console.log(formatSummary(results.getSummary()));
  // {
  //   download: "94.5 Mbps",
  //   upload: "21.3 Mbps",
  //   latency: "12.0 ms",
  //   jitter: "1.4 ms",
  //   downLoadedLatency: "38.0 ms",
  //   downLoadedJitter: "4.2 ms",
  //   upLoadedLatency: "29.0 ms",
  //   upLoadedJitter: "3.1 ms",
  //   packetLoss: "0.00%"
  // }
};

Intermediate vs. final results

The Results object is live — it updates as measurements complete. You can call getSummary() at any time, but its output changes as the test progresses.
Called after each individual measurement completes. The summary may be partial — some keys will be absent until their measurement runs.
const engine = new SpeedTest();

engine.onResultsChange = ({ type }) => {
  const summary = engine.results.getSummary();
  console.log(`Updated after: ${type}`, summary);
  // Keys present depend on which measurements have run so far
};
getSummary() and the individual getter methods return the same values. Use getSummary() when you need all metrics at once (e.g., for logging or sending to an analytics endpoint). Use the individual getters when you need a specific metric in a reactive UI.

Build docs developers (and LLMs) love