sindresorhus / speed-test Goto Github PK
View Code? Open in Web Editor NEWTest your internet connection speed and ping using speedtest.net from the CLI
License: MIT License
Test your internet connection speed and ping using speedtest.net from the CLI
License: MIT License
I have internet, and yet 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
speedtest-net npm already does this speed test.what is the need for new module.How is it different?
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
For those that want to use the results elsewhere.
PR welcome :)
https://github.com/sivel/speedtest-cli
It's written using python, so you can run it's everywhere.
On OSX just run brew install speedtest_cli
.
i think i miss something here....
Would be nice to add an option like --share
to get a link to share your result:
Hey, the wrong server is being selected for me, my servers located in London, UK, and the speedtest server from Norway is being selected. It's worked under a different IP I had in the past.
I was wondering if there was a fix for this?
I know in the past you said you'd like to keep this as simple as possible #45, but I was wondering if you'd reconsider or at least correct it so it does select the nearest server.
hello how can i use the json output as a json file cuz i want it for my discord bot
also good job
➜ speedtests speed-test
Ping
Download
Upload
events.js:160
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. (/usr/local/lib/node_modules/speed-test/node_modules/xml2js/lib/xml2js.js:484:18)
at emitOne (events.js:96:13)
at Parser.emit (events.js:188:7)
at Parser.exports.Parser.Parser.parseString (/usr/local/lib/node_modules/speed-test/node_modules/xml2js/lib/xml2js.js:494: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:535:19)
at /usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:236:5
➜ speedtests
Netflix's speed test Fast.com gives a more correct result of actual speeds, since it uses Netflix servers for testing, so that your ISP can't throttle the results as they can (and have been known to do) on speedtest.net.
Support for fast.com in this tool would be awesome. :)
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.
cscript test.js
Is there a way to run this with the default of always using the measurements of megabytes instead of always specifying the "-b" flag?
Ps. Great project btw!
There could be an option called --bytes
to show speeds in megabytes rather than megabits.
Would it be interesting to add proxy support to be able to see a proxy speed?
I'll be down to contribute if people are interested.
➜ ~ speed-test --version
1.7.0
➜ ~ speed-test
Ping ⠇
Download
Upload
events.js:154
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:484:18)
at emitOne (events.js:90:13)
at Parser.emit (events.js:182:7)
at Parser.exports.Parser.Parser.parseString (/usr/local/lib/node_modules/speed-test/node_modules/xml2js/lib/xml2js.js:494: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:535:19)
at /usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:236:5
Fix possible by upgrading github.com/ddsol/speedtest.net dependency to v1.2.7
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
Might be useful to some folks!
docker run --rm -it devmtl/speedtest:1.0A
FROM node:6-alpine
RUN apk update && apk upgrade && \
npm install --global speed-test && \
\
apk add --no-cache tini ca-certificates tzdata && \
cp /usr/share/zoneinfo/America/New_York /etc/localtime &&\
echo "America/New_York" > /etc/timezone &&\
apk del tzdata && \
rm -rf /var/cache/apk/*
ENTRYPOINT ["/sbin/tini", "--", "speed-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.
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
I'm getting this error: "TypeError: Cannot read property 'settings' of null"
Haven't had any problems before.
Started getting an error today on multiple machines
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:465:22)
at /usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:43:22
at /usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:226:13
at Parser.<anonymous> (/usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/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/speedtest-net/node_modules/xml2js/lib/xml2js.js:493:16)
at Parser.parseString (/usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/node_modules/xml2js/lib/xml2js.js:7:59)
at exports.parseString (/usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/node_modules/xml2js/lib/xml2js.js:534:19)
at /usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:224:9
Tried using node 5.0.0, 4.2.2 and 0.12.7 and received the same error.
Can it use in browser?
more like a question than a request of anything !
i like this project and i was wondering, there is some libs in the package.json... why there is not a lock file for that ? 🤔
https://github.com/ddsol/speedtest.net supports the following options:
maxTime
The maximum length of a single test run (upload or download)pingCount
The number of close servers to ping to find the fastest onemaxServers
The number of servers to run a download test on. The fastest is used for the upload test and the fastest result is reported at the end.headers
Headers to send to speedtest.netlog
(Visual only) Pass a truthy value to allow the run to output results to the console in addition to showing progress, or a function to be used instead of console.log
.serverId
ID of the server to restrict the tests against.serversUrl
URL to obtain the list of servers available for speed test. (default: http://www.speedtest.net/speedtest-servers-static.php)these should all be exposed as options (excepting maybe log, which is possibly already used with --verbose
?)
For me, this would be especially useful to select and test throughput for VPN vs normal connection on specific servers. I'll poke around and see if I can submit a PR for this.
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?
Often speedtest doesn't select the fastest speedtest server.
I see under the speedtest-net function there is a serverId, but you can't specify it via command line.
Would be nice if you could specify the server you want to use.
Give a speedtest.net/my-result/a/...
link to clipboard for sharing.
Every other speed test aligns with the theoretical speed I should be getting, namely 300Mb/s give or take .. However, speed-test shows a consistent speed of 45 Mb/s:
✝ ~ speed-test --verbose
Ping 67 ms
Download 42 Mbps
Upload 19 Mbps
Server speedtest1.citizens.coop
Location Floyd, VA (United States)
Distance 94 km
Compare to "fast" (the old one I used to use) :
✝ ~ fast
300 Mbps
Since it can take almost a minute, it'd be nice to have a progress monitor like on the web.
$ speed-test
Ping \
Download
Upload
× Error: Invalid character in entity name
Line: 61
Column: 40
Char:
at error (C:\Users\Mattaio\AppData\Roaming\npm\node_modules\speed-test\node_modules\sax\lib\sax.js:651:10)
at strictFail (C:\Users\Mattaio\AppData\Roaming\npm\node_modules\speed-test\node_modules\sax\lib\sax.js:677:7)
at SAXParser.write (C:\Users\Mattaio\AppData\Roaming\npm\node_modules\speed-test\node_modules\sax\lib\sax.js:1491:13)
at Parser.exports.Parser.Parser.parseString (C:\Users\Mattaio\AppData\Roaming\npm\node_modules\speed-test\node_modules\xml2js\lib\parser.js:325:31)
at Parser.parseString (C:\Users\Mattaio\AppData\Roaming\npm\node_modules\speed-test\node_modules\xml2js\lib\parser.js:5:59)
at exports.parseString (C:\Users\Mattaio\AppData\Roaming\npm\node_modules\speed-test\node_modules\xml2js\lib\parser.js:361:19)
at C:\Users\Mattaio\AppData\Roaming\npm\node_modules\speed-test\node_modules\speedtest-net\index.js:291:5
at C:\Users\Mattaio\AppData\Roaming\npm\node_modules\speed-test\node_modules\speedtest-net\index.js:97:16
at IncomingMessage.<anonymous> (C:\Users\Mattaio\AppData\Roaming\npm\node_modules\speed-test\node_modules\speedtest-net\index.js:167:7)
at IncomingMessage.emit (events.js:203:15)
speed-test
,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 ddsol/speedtest.net@8f53240 or ddsol/speedtest.net@dce7e7d
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)
After visiting the website and performing a speedtest, users are offered links to the results and a PNG image they can share containing the results of the test. It would be awesome if speed-test could provide this information, perhaps through a flag.
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.
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.
Hi,
I've noticed that if my latency to the testing server is below 1 ms, it'll show that the latency is 100 ms.
Rounding/math error?
Hello, please, can you help me with this error? I need to know if this library can be used on production servers. I'm using a library on a Windows production server and I want to capture the client's speed test, but this error is occurring:
Error: connect ECONNREFUSED 179.109.32.34:8080
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
Emitted 'error' event at: {
errno: -4078,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '179.109.32.34',
port: 8080
}
For example ping
has the -I
option:
$ ping 8.8.8.8 -I enp5s0
PING 8.8.8.8 (8.8.8.8) from x.x.x.x enp5s0: 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=49 time=40.5 ms
$ ping 8.8.8.8 -I tun0
PING 8.8.8.8 (8.8.8.8) from y.y.y.y tun0: 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=49 time=61.4 ms
Is there a similar option to select specific interface for speed test? If not, does anyone else think it would be a good idea to implement?
It is currently sending ✖ Please check your internet connection
even with the --json
option.
I think { "error": "Please check your internet connection" }
is better.
On Ubuntu 14.04:
$ speed-test
/usr/bin/env: node: No such file or directory
$
I tried to install the CLI but the dev dependency "update-notifier" reaches 0.5.0.
I got node v0.12.7 and npm v2.12.1
speed-test
Ping ⠼
Download
Upload
events.js:141
throw er; // Unhandled 'error' event
^
TypeError: Cannot read property 'settings' of null
at gotServers (/Users/crucial/.nvm/versions/node/v4.2.1/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:522:20)
at /Users/crucial/.nvm/versions/node/v4.2.1/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:48:16
at /Users/crucial/.nvm/versions/node/v4.2.1/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:238:7
at Parser.<anonymous> (/Users/crucial/.nvm/versions/node/v4.2.1/lib/node_modules/speed-test/node_modules/xml2js/lib/xml2js.js:484:18)
at emitOne (events.js:77:13)
at Parser.emit (events.js:169:7)
at Parser.exports.Parser.Parser.parseString (/Users/crucial/.nvm/versions/node/v4.2.1/lib/node_modules/speed-test/node_modules/xml2js/lib/xml2js.js:494:16)
at Parser.parseString (/Users/crucial/.nvm/versions/node/v4.2.1/lib/node_modules/speed-test/node_modules/xml2js/lib/xml2js.js:7:59)
at exports.parseString (/Users/crucial/.nvm/versions/node/v4.2.1/lib/node_modules/speed-test/node_modules/xml2js/lib/xml2js.js:535:19)
at /Users/crucial/.nvm/versions/node/v4.2.1/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:236:5
version 1.7.0
$ speed-test --verbose
Ping ⠧
Download
Upload
Server
Location
Distance
/usr/local/lib/node_modules/speed-test/cli.js:93
server.host = new URL(server.url).host;
^
TypeError: URL is not a constructor
at map (/usr/local/lib/node_modules/speed-test/cli.js:93:16)
at EventEmitter.st.once.server (/usr/local/lib/node_modules/speed-test/cli.js:108:12)
at EventEmitter.g (events.js:292:16)
at emitOne (events.js:96:13)
at EventEmitter.emit (events.js:188:7)
at startDownload (/usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:708:10)
at /usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:685:7
at /usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:388:11
at /usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:118:16
at /usr/local/lib/node_modules/speed-test/node_modules/speedtest-net/index.js:353:16
this is not an issue at all, I just wanted to thank you for this awesome tool! 😃
Hi,
It's possible to force one of ookla server for executing a speedtest?
thank you.
Yuri
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.