fast-speedtest-api
fast-speedtest-api copied to clipboard
Get all values in verbose mode
In verbose mode, all the download speeds are available and logged in the console. Is there anyway to get the values as a response from the promise? i want to stream all the values to a client through WS
This feature is not available at the moment, I'm going to think about implementing it
I just added an event listener (https://github.com/branchard/fast-speedtest-api/commit/5b90bcdfc9454e198ffd3719b3fafd3d4bff7398) that allows to pass a callback that's called every time a mesure is done.
You can use it like that:
const FastSpeedtest = require('../src/Api');
let speedtest = new FastSpeedtest({
token: 'the-key'
});
speedtest.addListener(FastSpeedtest.EVENTS.measure, (currentSpeed) => {
console.log(`Current speed: ${currentSpeed} ${FastSpeedtest.UNITS.Mbps.name}`);
});
speedtest.getSpeed().then(s => {
console.log(`Speed: ${s} ${FastSpeedtest.UNITS.Mbps.name}`);
}).catch(e => {
console.error(e.message);
});
For the moment it is only available in the dev branch.