Package Exports
- universal-speedtest
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (universal-speedtest) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
universal-speedtest
Measure the speed of your internet connection with Netflix's Fast.com speed test, cz.nic's Netmetr.cz speed test or Ookla's Speedtest.net speed test.
Installation
$ npm install --save universal-speedtestExample usage
const { UniversalSpeedTest, SpeedUnits } = require('universal-speedtest');
const SpeedTest = new UniversalSpeedTest({
measureUpload: true,
downloadUnit: SpeedUnits.MBps,
timeout: 60000
});
SpeedTest.runTestByFast().then(result => {
console.log(`Ping: ${result.ping} ${result.pingUnit}`);
console.log(`Download speed: ${result.downloadSpeed} ${result.downloadUnit}`);
console.log(`Upload speed: ${result.uploadSpeed} ${result.uploadUnit}`);
}).catch(e => {
console.error(e.message);
});Available Test Pages
| Function | Page |
|---|---|
| runTestByFast() | Fast.com |
| runTestByNetmetr() | Netmetr.cz |
| runTestBySpeedtest() | Speedtest.net |
Available Options
| Property | Type | Default | Description |
|---|---|---|---|
| measureUpload F | Boolean | false | To wait for the upload speed result |
| uploadUnit | SpeedUnits / String | Mbps | The resulting unit of upload speed |
| downloadUnit | SpeedUnits / String | Mbps | The resulting unit of download speed |
| timeout | Number | 40000 | Limit how long the speed test can run |
| executablePath | String | - | Path to the Chrome startup file. You can use it if Puppeteer failed to start. |
F only available for Fast.com speed test
Test result
| Property | Type | Description |
|---|---|---|
| ping* | Number | Network ping |
| downloadSpeed | Number | Network download speed |
| uploadSpeed* | Number | Network upload speed |
| pingUnit* | String | Network ping unit |
| downloadUnit | String | Network download speed unit |
| uploadUnit* | String | Network upload speed unit |
| servers F | String[] | Location(s) of test server(s) |
* only available when the "measureUpload" property is set to true F only available for Fast.com speed test
TODO
I want to make this package multifunctional to allow the use of additional speed testing sites and to allow you to choose the best test exactly for you.