-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from karelkryda/dev
Version 2.0.0
- Loading branch information
Showing
26 changed files
with
3,470 additions
and
2,388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": [ | ||
"@typescript-eslint" | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"mocha": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"no-console": "off", | ||
"linebreak-style": "off", | ||
"quotes": [ | ||
"error", | ||
"double", | ||
{ | ||
"allowTemplateLiterals": true | ||
} | ||
], | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"mocha": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
"keyword-spacing": [ | ||
"error", | ||
{ | ||
"before": true | ||
} | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"no-console": "off", | ||
"linebreak-style": "off", | ||
"quotes": [ | ||
"error", | ||
"double", | ||
{ | ||
"allowTemplateLiterals": true | ||
} | ||
], | ||
"keyword-spacing": [ | ||
"error", | ||
{ | ||
"before": true | ||
} | ||
], | ||
"space-before-blocks": [ | ||
"error" | ||
] | ||
} | ||
"space-before-blocks": [ | ||
"error" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,4 +101,7 @@ dist | |
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
.tern-port | ||
|
||
# Test file | ||
test.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
{ | ||
"cache": false, | ||
"check-coverage": true, | ||
"extension": [ | ||
".ts" | ||
], | ||
"include": [ | ||
"**/src/*.ts" | ||
], | ||
"reporter": [ | ||
"cobertura", | ||
"text-summary" | ||
], | ||
"statements": 90, | ||
"branches": 90, | ||
"functions": 90, | ||
"lines": 90 | ||
"cache": false, | ||
"check-coverage": true, | ||
"extension": [ | ||
".ts" | ||
], | ||
"include": [ | ||
"**/src/*.ts" | ||
], | ||
"reporter": [ | ||
"cobertura", | ||
"text-summary" | ||
], | ||
"statements": 90, | ||
"branches": 90, | ||
"functions": 90, | ||
"lines": 90 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,22 @@ | ||
<a href="https://fast.com"><img src="https://fast.com/assets/new-logo-vert-37861c.svg" alt="fast.com logo" height="120px" /></a> | ||
|
||
<a href="https://www.netmetr.cz/en"><img src="https://www.netmetr.cz/theme/images/netmetr-logo.svg" alt="netmetr.cz logo" height="120px" /></a> | ||
|
||
<a href="https://www.speedtest.net/"><img src="https://upload.wikimedia.org/wikipedia/commons/0/09/Speedtest.net_logo.svg" alt="netmetr.cz logo" height="120px" /></a> | ||
# Universal Speedtest | ||
|
||
# universal-speedtest | ||
[![Build Status](https://travis-ci.com/karelkryda/universal-speedtest.svg?branch=master)](https://travis-ci.com/github/karelkryda/universal-speedtest) | ||
[![NPM version](https://img.shields.io/npm/v/universal-speedtest.svg?colorB=0a7bbb)](https://www.npmjs.com/package/universal-speedtest) | ||
[![GitHub license](https://img.shields.io/github/license/karelkryda/universal-speedtest.svg?colorB=0a7bbb)](https://github.com/karelkryda/universal-speedtest/blob/master/LICENSE) | ||
|
||
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. | ||
Measure the speed of your internet connection with various speed tests. | ||
|
||
## Installation | ||
|
||
```bash | ||
$ npm install --save universal-speedtest | ||
``` | ||
## Documentation: | ||
For Universal Speedtest v2, visit the new [documentation](https://karel-kryda.gitbook.io/universal-speedtest/) | ||
|
||
## Example usage | ||
```js | ||
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 <sup>**F**</sup> | 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 <sup>**F**</sup> | 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 | ||
## Beta release | ||
Until release 2.1, this is a beta version. There may be bugs in the library that will need to be fixed. | ||
<br> | ||
I'll be happy if you open and report a problem, if you find one, and help me improve this library. | ||
|
||
## 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. | ||
Thank you for understanding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.