Test your internet connection speed and ping using speedtest.net from the CLI

Overview

speed-test

Test your internet connection speed and ping using speedtest.net from the CLI

Install

Ensure you have Node.js version 8+ installed. Then run the following:

$ npm install --global speed-test

Usage

$ speed-test --help

  Usage
    $ speed-test

  Options
    --json -j     Output the result as JSON
    --bytes -b    Output the result in megabytes per second (MBps)
    --verbose -v  Output more detailed information

Links

Related

  • fast-cli - Test your download speed using fast.com

License

MIT © Sindre Sorhus

Comments
  • Cannot read property 'settings' of null

    Cannot read property 'settings' of null

    1. Instal/update,
    2. Run speed-test,
    3. See:
    speed-test
    
          Ping ⠹
      Download
        Upload
    events.js:141
          throw er; // Unhandled 'error' event
          ^
    
    TypeError: Cannot read property 'settings' of null
        at gotServers (/usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:522:20)
        at /usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:48:16
        at /usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:238:7
        at Parser.<anonymous> (/usr/local/lib/node_modules/speed-test/node_modules/xml2js/lib/xml2js.js:483:18)
        at emitOne (events.js:77:13)
        at Parser.emit (events.js:169:7)
        at Parser.exports.Parser.Parser.parseString (/usr/local/lib/node_modules/speed-test/node_modules/xml2js/lib/xml2js.js:493:16)
        at Parser.parseString (/usr/local/lib/node_modules/speed-test/node_modules/xml2js/lib/xml2js.js:7:59)
        at exports.parseString (/usr/local/lib/node_modules/speed-test/node_modules/xml2js/lib/xml2js.js:534:19)
        at /usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:236:5
    

    seems like a bug caused by a change in https://github.com/ddsol/speedtest.net . I'd say it's either https://github.com/ddsol/speedtest.net/commit/8f53240a4e561f1dc1bd4f91bc098d3d64f674a9 or https://github.com/ddsol/speedtest.net/commit/dce7e7d93d24ebe0e1a3f48c1cc1fddd7cfc0959

    bug help wanted 
    opened by meeDamian 10
  • not working in google cloud shell

    not working in google cloud shell

     speed-test
           Ping ⠋ 
       Download
         Upload
    ✖ Error: No server found, verify your proxy/network
        at gotServers (/usr/local/nvm/versions/node/v10.14.2/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:634:25)
        at /usr/local/nvm/versions/node/v10.14.2/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:118:16
        at /usr/local/nvm/versions/node/v10.14.2/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:317:7
        at Parser.<anonymous> (/usr/local/nvm/versions/node/v10.14.2/lib/node_modules/speed-test/node_modules/xml2js/lib/parser.js:304:18)
        at Parser.emit (events.js:182:13)
        at Parser.exports.Parser.Parser.parseString (/usr/local/nvm/versions/node/v10.14.2/lib/node_modules/speed-test/node_modules/xml2js/lib/parser.js:314:16)
        at Parser.parseString (/usr/local/nvm/versions/node/v10.14.2/lib/node_modules/speed-test/node_modules/xml2js/lib/parser.js:5:59)
        at exports.parseString (/usr/local/nvm/versions/node/v10.14.2/lib/node_modules/speed-test/node_modules/xml2js/lib/parser.js:369:19)
        at /usr/local/nvm/versions/node/v10.14.2/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:315:5
        at /usr/local/nvm/versions/node/v10.14.2/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:118:16
    
    opened by brakdag 7
  • Print user-friendly error if internet is down

    Print user-friendly error if internet is down

    Yesterday my internet seemed very slow so I used speed-test to test it. It seemed my internet connection was down entirely and it couldn't reach the speed-test servers.

    { [Error: getaddrinfo ENOTFOUND www.speedtest.net www.speedtest.net:80]
      code: 'ENOTFOUND',
      errno: 'ENOTFOUND',
      syscall: 'getaddrinfo',
      hostname: 'www.speedtest.net',
      host: 'www.speedtest.net',
      port: 80 }
    

    So I thought it would be a good idea to show a more user-friendly error if this happens. Feel free to suggest another error message or to not merge at all :).

    opened by SamVerschueren 7
  • Drop the decimal when more than 10 mbps

    Drop the decimal when more than 10 mbps

    For download/upload it would be a nicer UX if we dropped the decimal when it's more than 10 mbps. Fractions don't matter after that.

    @SamVerschueren Thoughts?

    enhancement help wanted 
    opened by sindresorhus 7
  • Just spins on Ping

    Just spins on Ping

    Any reason the test would just spin and stick on the Ping?

    Not really sure if it is an issue but it is what I am seeing when I run the test in OSX Terminal.

    opened by pixmonkey 6
  • Verbose mode

    Verbose mode

    Would be useful to have a --verbose flag that displays more info, like which server it connects to, etc.

    What would you like to have included in the verbose output?

    Available info can be found here: https://github.com/ddsol/speedtest.net#data

    enhancement help wanted 
    opened by sindresorhus 6
  • Show result faster

    Show result faster

    Web UI is faster to use. I can get ping right after first donwload bytes. I can view a download speed before it will download all files.

    In most time I didn’t interesting in upload speed, but anyway in CLI I need to wait this check before get ping and download results.

    opened by ai 6
  • Add timestamp to the JSON output

    Add timestamp to the JSON output

    • Updated readme to include batch example
    • The timestamp is only included via json argument and verbose all together, providing ability to monitor the results via some tool
    opened by gnud 5
  • Add --verbose flag

    Add --verbose flag

    Resolved issue https://github.com/sindresorhus/speed-test/issues/6 by adding the --verbose flag.

    I also added extra tests for testing the json outputs. It seems that t does not work inside cp.stdout.on('data', .... Is this in issue in AVA or not? I fixed it by calling kill if the json is not correct which will throw an error which will fail the test.

    @sindresorhus I know I have access to the repo, but want your consent on this ;).

    opened by SamVerschueren 5
  • Show current download speed during the test

    Show current download speed during the test

    In SpeedTest site I can understand average download speed even before test is finished, because it shows current download speed. It is not accurate, but enough in many cases.

    enhancement help wanted 
    opened by ai 5
  • Object has no method 'trunc'

    Object has no method 'trunc'

    Happening on both my Centos7.2 and raspberry pi 2 systems.

    /usr/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:95
    NT 6.3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.' + Math.trunc(Math
                                                                        ^
    TypeError: Object #<Object> has no method 'trunc'
        at getHttp (/usr/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:95:158)
        at getXML (/usr/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:234:3)
        at speedTest (/usr/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:492:3)
        at Object.<anonymous> (/usr/lib/node_modules/speed-test/cli.js:83:10)
        at Module._compile (module.js:456:26)
        at Object.Module._extensions..js (module.js:474:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Function.Module.runMain (module.js:497:10)
        at startup (node.js:119:16)
    
    opened by jwiebalk 3
  • No server found

    No server found

    I have internet, and thus I get "no server found" error

    joao@delft:~$ sudo npm install --global speed-test
    [sudo] senha para joao: 
    
    added 122 packages, and audited 123 packages in 3s
    
    48 packages are looking for funding
      run `npm fund` for details
    
    found 0 vulnerabilities
    npm notice 
    npm notice New major version of npm available! 8.19.2 -> 9.1.2
    npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.1.2
    npm notice Run npm install -g [email protected] to update!
    npm notice 
    joao@delft:~$ speed-test
    
          Ping ⠏ 
      Download   
        Upload   
    ✖ Error: No server found, verify your proxy/network
        at gotServers (/usr/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:649:25)
        at /usr/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:119:16
        at /usr/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:330:7
        at Parser.<anonymous> (/usr/lib/node_modules/speed-test/node_modules/xml2js/lib/parser.js:304:18)
        at Parser.emit (node:events:513:28)
        at SAXParser.onclosetag (/usr/lib/node_modules/speed-test/node_modules/xml2js/lib/parser.js:262:26)
        at emit (/usr/lib/node_modules/speed-test/node_modules/sax/lib/sax.js:624:35)
        at emitNode (/usr/lib/node_modules/speed-test/node_modules/sax/lib/sax.js:629:5)
        at closeTag (/usr/lib/node_modules/speed-test/node_modules/sax/lib/sax.js:889:7)
        at SAXParser.write (/usr/lib/node_modules/speed-test/node_modules/sax/lib/sax.js:1436:13)
    joao@delft:~$ ping google.com
    PING google.com(ams16s32-in-x0e.1e100.net (2a00:1450:400e:80c::200e)) 56 data bytes
    64 bytes from ams16s32-in-x0e.1e100.net (2a00:1450:400e:80c::200e): icmp_seq=1 ttl=119 time=3.57 ms
    64 bytes from ams16s32-in-x0e.1e100.net (2a00:1450:400e:80c::200e): icmp_seq=2 ttl=119 time=3.36 ms
    64 bytes from ams16s32-in-x0e.1e100.net (2a00:1450:400e:80c::200e): icmp_seq=3 ttl=119 time=3.72 ms
    64 bytes from ams16s32-in-x0e.1e100.net (2a00:1450:400e:80c::200e): icmp_seq=4 ttl=119 time=3.82 ms
    64 bytes from ams16s32-in-x0e.1e100.net (2a00:1450:400e:80c::200e): icmp_seq=5 ttl=119 time=4.08 ms
    64 bytes from ams16s32-in-x0e.1e100.net (2a00:1450:400e:80c::200e): icmp_seq=6 ttl=119 time=3.69 ms
    64 bytes from ams16s32-in-x0e.1e100.net (2a00:1450:400e:80c::200e): icmp_seq=7 ttl=119 time=3.61 ms
    ^C
    --- google.com ping statistics ---
    7 packets transmitted, 7 received, 0% packet loss, time 6009ms
    rtt min/avg/max/mdev = 3.361/3.691/4.075/0.205 ms
    
    
    opened by jfoclpf 1
  • Feature request: Add a timestamp in the JSON output

    Feature request: Add a timestamp in the JSON output

    It would be lovely if you introduce a timestamp in the JSON output, so that if I probe with this app every few minutes I would know the probe time.

    For the moment I need to transform the JSON output each time the app completes, or if we can have append custom object application arguments with data generated from somewhere else. E.g: speed-test -v -j -d '{"ts": "fdffd", "hostname": "pc1"}'

    that way you don't have to change a lot, just at the end of the result generation to merge the arguments object.

    Thanks.

    opened by gnud 6
  • Sometimes incorrect speed

    Sometimes incorrect speed

    Any comment on the differences?

    $ speed-test 
          Ping  6 ms
      Download  12.8 Mbps
        Upload  8371.5 Mbps
    $
    
    www.speedtest.net/
          Ping  60 ms
      Download  24 Mbps
        Upload  26 Mbps
    
    bug help wanted 
    opened by johnmudd 8
Releases(v3.0.0)
Owner
Sindre Sorhus
Full-Time Open-Sourcerer. Wants more empathy & kindness in open source. Focuses on Swift & JavaScript. Makes macOS apps, CLI tools, npm packages. Likes unicorns
Sindre Sorhus
LinkFree CLI is a command line tool that helps you to create your LinkFree profile through CLI.

LinkFree CLI LinkFree CLI is a command line tool that helps you to create your LinkFree profile through CLI. Demo Using the CLI (Commands) Note First

Pradumna Saraf 32 Dec 26, 2022
Gh-action-dotnet-bump - Automatic bump version of .NET solution by following semantic release

gh-action-dotnet-bump GitHub action which bumps the library version that follows Semantic Versioning. NOTICE: Pre-release functionality for type=assem

Jonas Lagoni 2 Oct 21, 2022
Pretty diff to html javascript cli (diff2html-cli)

diff2html-cli Diff to Html generates pretty HTML diffs from unified and git diff output in your terminal Table of Contents Features Online Example Dis

Rodrigo Fernandes 404 Dec 19, 2022
DataENV is a cli tool that allows you to save data temporarily using your terminal.

DataEnv CLI Instllation npm install -g dataenv Usage Table of Contents LocalStorage npx dataenv save Parameters npx dataenv show Parameters npx dataen

PGamerX 2 Feb 5, 2022
:white_square_button: WhatsApp chat from commandline/console/cli using GoogleChrome puppeteer

Whatspup Use Whatsapp from commandline/console/cli using GoogleChrome puppeteer! ?? Features ✅ Send and receive messages ✅ Read Receipts ✅ Switch betw

Sarfraz Ahmed 343 Dec 1, 2022
A CLI for peer-to-peer file sharing using the Hypercore Protocol.

A CLI for peer-to-peer file sharing (and more) using the Hypercore Protocol.

Hypercore Protocol 207 Dec 30, 2022
HMSC (How Much Stuffs CLI) analyst for your files and folders

HMSC ?? About HMSC (How Much Stuffs CLI) analyst for your files and folders ?? Screenshot ?? Requirements Node.js NPM ?? Installation $ npm i -g hmsc

Abdullah Veliyev 26 Jan 10, 2022
An extension geared towards Spotify users with larger libraries; view all your playlists that contain a specific song with the click of a button. Designed for Spicetify (https://github.com/khanhas/spicetify-cli)

ViewPlaylistsWithSong An extension developed for Spicetify that allows you to view all the playlists in your library that contain a certain song. Idea

null 21 Dec 13, 2022
A C++ based command-line (CLI) program that lets you manage your tasks

COMMAND LINE INTERFACE TODO APP a command-line (CLI) program that lets you manage your tasks. The specification for this project is written down as te

Rahul Prabhakar 1 Dec 25, 2021
Fresko - A configurable cli that keeps your project deps fresh

?? Fresko (fresh in Basque) A configurable cli that keeps your project deps fresh Why? Have you ever pulled someone else's code into your local enviro

Quentin Hello 9 Nov 21, 2022
A CLI to add and remove local development environments and create HTTPS certificates for them.

A CLI used to create a local https dev environment with the green lock. Setup takes less than 5 minutes and all of your projects will be running locally over HTTPS with custom domain names in no time!

Entrostat (Pty) Ltd 5 Sep 19, 2022
Infinite Red's cutting edge React Native project boilerplate, along with a CLI, component/model generators, and more!

Ignite - the hottest React Native boilerplate Battle-tested React Native boilerplate The culmination of five years of constant React Native developmen

Infinite Red, Inc. 14.7k Dec 29, 2022
Tasks Management CLI application with Nodejs, Mongodb, inquirer.js, and commander

Tasks CLI Tasks CLI is a program to manage your tasks in a database using terminal or console. This is a sample project for beginners Requirements Nod

Fazt Web 9 Nov 17, 2022
A simple CLI tool to create and manage xhelpers-api projects

A simple CLI tool to create and manage xhelpers-api projects

null 2 Feb 25, 2022
NodeJS built CLI, allows to spell check in 14 languages, get Coleman-Liau Index and build hash Pyramids

Magic CLI ?? ?? NodeJS built CLI, allows to spell check in 14 languages, get Coleman-Liau Index and build hash Pyramids Installing Install dependencie

Lucas 3 Sep 27, 2022
CLI tool for running Yeoman generators

yo What's Yeoman? Yeoman helps you to kickstart new projects, prescribing best practices and tools to help you stay productive. To do so, we provide a

Yeoman 3.6k Dec 30, 2022
Distributed, realtime CLI for live Node apps.

Vantage = CLI + SSH + REPL for your live node app. In one line: require("vantage")().listen(4000); What just happened? That's voodoo magic: show me th

dc 3.5k Dec 30, 2022
download torrents with node from the CLI

torrent Download torrents from the command line usage torrent <magnet link OR path to .torrent file> Download a torrent from a magnet link to torre

Max Ogden 619 Dec 26, 2022