├── .npmrc ├── .travis.yml ├── .github └── FUNDING.yml ├── test.js ├── package.json ├── LICENSE ├── .gitignore ├── README.md ├── cli.js └── speedo.svg /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "node" 4 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: xxczaki 4 | patreon: akepinski 5 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import execa from 'execa'; 3 | 4 | test('Test general output', async t => { 5 | const {stdout} = await execa.shell('node ./cli.js'); 6 | t.true(stdout.length > 0); 7 | }); 8 | 9 | test('Test --help output', async t => { 10 | const {stdout} = await execa.shell('node ./cli.js --help'); 11 | t.true(stdout.length > 0); 12 | }); 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "speedo-cli", 3 | "version": "2.4.0", 4 | "description": "Internet speed report in your terminal!", 5 | "main": "./cli.js", 6 | "bin": { 7 | "speedo": "./cli.js" 8 | }, 9 | "scripts": { 10 | "test": "xo && ava" 11 | }, 12 | "keywords": [ 13 | "speedo-cli", 14 | "speedo", 15 | "speedtest", 16 | "speed", 17 | "cli", 18 | "internet", 19 | "download", 20 | "upload", 21 | "report", 22 | "npm", 23 | "nodejs", 24 | "akepinski" 25 | ], 26 | "author": "Antoni Kepinski (https://kepinski.me)", 27 | "license": "MIT", 28 | "repository": { 29 | "type": "git", 30 | "url": "https://github.com/xxczaki/speedo-cli.git" 31 | }, 32 | "dependencies": { 33 | "chalk": "^2.4.2", 34 | "cli-table3": "^0.5.1", 35 | "meow": "^5.0.0", 36 | "ora": "^3.2.0", 37 | "speedtest-net": "^1.5.1" 38 | }, 39 | "devDependencies": { 40 | "ava": "*", 41 | "execa": "*", 42 | "xo": "*" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Antoni Kepinski 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

Speedo

4 |

Internet speed report in your terminal!

5 | 6 |

7 | Build Status 8 | Coverage Status 9 | XO Code Style 10 | Unicorn Approved 11 |

12 | 13 |

SVG

14 | 15 | ## :floppy_disk: Usage 16 | 17 | Just run `npx speedo-cli` to start a speed test :unicorn: 18 | 19 | 20 | 21 | 22 | 23 | ## :wave: Thanks 24 | 25 | - [speedtest-net](https://github.com/ddsol/speedtest.net) for providing fast & simple API! 26 | 27 | ## :clipboard: License 28 | 29 | MIT © [Antoni Kepinski](https://akepinski.me) 30 | -------------------------------------------------------------------------------- /cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | const chalk = require('chalk'); 6 | const meow = require('meow'); 7 | const speedTest = require('speedtest-net'); 8 | const Table = require('cli-table3'); 9 | const ora = require('ora'); 10 | 11 | const spinner = ora(); 12 | 13 | // Help message 14 | meow(` 15 | Usage: 16 | Just run ${chalk.green.bold('speedo')} to start a speed test! 17 | 18 | Powered by ${chalk.cyan('speedtest.net')} 19 | `); 20 | 21 | // Speed test configuration 22 | const st = speedTest({maxTime: 5250}); 23 | 24 | // Output in MB/s 25 | st.on('data', async data => { 26 | const download = await (data.speeds.download * 0.125).toFixed(2); 27 | const upload = await (data.speeds.upload * 0.125).toFixed(2); 28 | 29 | // Table 30 | const table = new Table({ 31 | head: [`${chalk.red.bold('Type:')}`, `${chalk.red.bold('Speed:')}`], 32 | colWidths: [25, 25] 33 | }); 34 | 35 | table.push( 36 | [`${chalk.cyan('Download')}`, `${chalk.green(`${download}`)} MB/s`], 37 | [`${chalk.cyan('Upload')}`, `${chalk.green(`${upload}`)} MB/s`], 38 | [`${chalk.cyan('Latency')}`, `${chalk.green(`${data.server.ping}`)} ms`] 39 | ); 40 | 41 | // Print the final report table 42 | spinner.succeed('Done! Here is your speed report:\n'); 43 | console.log(table.toString()); 44 | }); 45 | 46 | // Download and Upload speed log 47 | st.on('downloadspeedprogress', async speed => { 48 | spinner.text = `Testing download speed... ${chalk.green(`${(await speed * 0.125).toFixed(2)} MB/s`)}`; 49 | spinner.start(); 50 | }); 51 | st.on('uploadspeedprogress', async speed => { 52 | spinner.text = `Testing upload speed... ${chalk.yellow(`${(await speed * 0.125).toFixed(2)} MB/s`)}`; 53 | spinner.start(); 54 | }); 55 | 56 | // Handle the error 57 | st.on('error', err => { 58 | /* istanbul ignore next */ 59 | if (err.code === 'ENOTFOUND') { 60 | console.error(chalk.red.bold('Unable to connect to the server :(')); 61 | } 62 | }); 63 | -------------------------------------------------------------------------------- /speedo.svg: -------------------------------------------------------------------------------- 1 | ~speedoTestingdownloadspeed...11.60MB/sDone!Hereisyourspeedreport:┌─────────────────────────┬─────────────────────────┐Type:Speed:├─────────────────────────┼─────────────────────────┤Download11.85MB/sUpload3.58MB/sLatency12ms└─────────────────────────┴─────────────────────────┘~took12sspeedospeedospeedospeedospeedoTestingdownloadspeed...4.43MB/sTestingdownloadspeed...8.37MB/sTestingdownloadspeed...8.37MB/sTestingdownloadspeed...9.10MB/sTestingdownloadspeed...9.18MB/sTestingdownloadspeed...9.18MB/sTestingdownloadspeed...8.88MB/sTestingdownloadspeed...9.93MB/sTestingdownloadspeed...9.93MB/sTestingdownloadspeed...9.43MB/sTestingdownloadspeed...10.19MB/sTestingdownloadspeed...10.19MB/sTestingdownloadspeed...10.19MB/sTestingdownloadspeed...10.13MB/sTestingdownloadspeed...10.13MB/sTestingdownloadspeed...10.66MB/sTestingdownloadspeed...10.66MB/sTestingdownloadspeed...10.66MB/sTestingdownloadspeed...10.52MB/sTestingdownloadspeed...10.52MB/sTestingdownloadspeed...10.97MB/sTestingdownloadspeed...10.97MB/sTestingdownloadspeed...10.97MB/sTestingdownloadspeed...10.97MB/sTestingdownloadspeed...10.97MB/sTestingdownloadspeed...10.97MB/sTestingdownloadspeed...10.75MB/sTestingdownloadspeed...10.75MB/sTestingdownloadspeed...10.75MB/sTestingdownloadspeed...10.75MB/sTestingdownloadspeed...11.23MB/sTestingdownloadspeed...11.23MB/sTestingdownloadspeed...11.23MB/sTestingdownloadspeed...11.23MB/sTestingdownloadspeed...11.23MB/sTestingdownloadspeed...11.23MB/sTestingdownloadspeed...11.32MB/sTestingdownloadspeed...11.32MB/sTestingdownloadspeed...11.32MB/sTestingdownloadspeed...11.32MB/sTestingdownloadspeed...11.60MB/sTestingdownloadspeed...11.60MB/sTestingdownloadspeed...11.60MB/sTestingdownloadspeed...11.60MB/sTestingdownloadspeed...11.60MB/sTestingdownloadspeed...11.60MB/sTestingdownloadspeed...11.60MB/sTestingdownloadspeed...11.60MB/sTestingdownloadspeed...11.60MB/sTestingdownloadspeed...11.47MB/sTestingdownloadspeed...11.47MB/sTestingdownloadspeed...11.47MB/sTestingdownloadspeed...11.47MB/sTestingdownloadspeed...11.47MB/sTestingdownloadspeed...11.47MB/sTestingdownloadspeed...11.47MB/sTestingdownloadspeed...11.90MB/sTestingdownloadspeed...11.90MB/sTestingdownloadspeed...11.90MB/sTestingdownloadspeed...11.90MB/sTestingdownloadspeed...11.90MB/sTestingdownloadspeed...11.90MB/sTestingdownloadspeed...11.90MB/sTestingdownloadspeed...11.90MB/sTestingdownloadspeed...11.90MB/sTestingdownloadspeed...11.90MB/sTestingdownloadspeed...11.85MB/sTestingdownloadspeed...11.85MB/sTestingdownloadspeed...11.85MB/sTestingdownloadspeed...11.85MB/sTestingdownloadspeed...11.85MB/sTestingdownloadspeed...11.85MB/sTestingdownloadspeed...11.85MB/sTestingdownloadspeed...11.85MB/sTestingdownloadspeed...12.13MB/sTestinguploadspeed...0.81MB/sTestinguploadspeed...1.02MB/sTestinguploadspeed...1.34MB/sTestinguploadspeed...1.71MB/sTestinguploadspeed...1.71MB/sTestinguploadspeed...1.99MB/sTestinguploadspeed...1.99MB/sTestinguploadspeed...2.20MB/sTestinguploadspeed...2.20MB/sTestinguploadspeed...2.37MB/sTestinguploadspeed...2.38MB/sTestinguploadspeed...2.53MB/sTestinguploadspeed...2.65MB/sTestinguploadspeed...2.65MB/sTestinguploadspeed...2.74MB/sTestinguploadspeed...2.74MB/sTestinguploadspeed...2.83MB/sTestinguploadspeed...2.83MB/sTestinguploadspeed...2.91MB/sTestinguploadspeed...2.91MB/sTestinguploadspeed...2.97MB/sTestinguploadspeed...2.94MB/sTestinguploadspeed...2.94MB/sTestinguploadspeed...3.01MB/sTestinguploadspeed...3.01MB/sTestinguploadspeed...3.06MB/sTestinguploadspeed...3.11MB/sTestinguploadspeed...3.11MB/sTestinguploadspeed...3.15MB/sTestinguploadspeed...3.15MB/sTestinguploadspeed...3.21MB/sTestinguploadspeed...3.21MB/sTestinguploadspeed...3.23MB/sTestinguploadspeed...3.28MB/sTestinguploadspeed...3.28MB/sTestinguploadspeed...3.29MB/sTestinguploadspeed...3.29MB/sTestinguploadspeed...3.34MB/sTestinguploadspeed...3.34MB/sTestinguploadspeed...3.35MB/sTestinguploadspeed...3.39MB/sTestinguploadspeed...3.39MB/sTestinguploadspeed...3.40MB/sTestinguploadspeed...3.40MB/sTestinguploadspeed...3.44MB/sTestinguploadspeed...3.44MB/sTestinguploadspeed...3.45MB/sTestinguploadspeed...3.48MB/sTestinguploadspeed...3.48MB/sTestinguploadspeed...3.48MB/sTestinguploadspeed...3.48MB/sTestinguploadspeed...3.51MB/sTestinguploadspeed...3.51MB/sTestinguploadspeed...3.52MB/sTestinguploadspeed...3.55MB/sTestinguploadspeed...3.55MB/sTestinguploadspeed...3.55MB/sTestinguploadspeed...3.55MB/s├─────────────────────────┼──── --------------------------------------------------------------------------------