Yes, speed.cloudflare.com, a cloud services offering from Cloudflare, provides a JavaScript API for testing internet speed.
To use the @cloudflare/speedtest API, you first need to install it using your preferred package manager. For example, if you are using npm, you can install it with the following command:
npm install @cloudflare/speedtest
Once you have installed the @cloudflare/speedtest API, you can import it into your JavaScript code and start using it to test internet speed. The following example shows how to use the @cloudflare/speedtest API to test download and upload speed:
Simple Usage:
import SpeedTest from '@cloudflare/speedtest'; new SpeedTest().onFinish = results => console.log(results.getSummary());
This code will start a speed test and log the download and upload speed to the console. You can use this code as a starting point to develop your own speed test application or to integrate internet speed testing into your existing application.
Here is a link to the documentation for the @cloudflare/speedtest API: github