fast-speedtest-api icon indicating copy to clipboard operation
fast-speedtest-api copied to clipboard

Example use as the documentation is not good:

Open aishtiaq7 opened this issue 4 years ago • 2 comments

`

speedTestMbps().then(res=> console.log(res)); //Test net speed.

const FastSpeedtest = require("fast-speedtest-api");
//Returns float for Mbps
//'timeout' miliseconds tests for how long the data download speed was tested.
async function speedTestMbps(msg) {
let speedtest = new FastSpeedtest({
	token: "YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm", // required
	verbose: false, // default: false
	timeout: 10000, // default: 5000
	https: true, // default: true
	urlCount: 5, // default: 5
	bufferSize: 8, // default: 8 
	unit: FastSpeedtest.UNITS.Mbps // default: Bps
});

try {
	const s = await speedtest.getSpeed();
	console.log(`Speed: ${s} Mbps`);
	return s;
} catch (e) {
	console.error(e.message);
}

}

`

aishtiaq7 avatar May 07 '21 07:05 aishtiaq7

@aishtiaq7 how long the token remains valid ?

yogesh021 avatar Feb 13 '24 07:02 yogesh021

speedtest

Not sure about that. Might have to refer to its documentation for that.

aishtiaq7 avatar Feb 13 '24 07:02 aishtiaq7