1.0.3 • Published 5 years ago
@petervn1/speedtestjs v1.0.3
speedtestjs
A JavaScript library to evaluate a network latency between a client browser and AWS EC2 regions
Usage
<html>
<head>
<script src="./speedtest.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript"><!--
function doSpeedTest() {
const regions = [
"ap-southeast-2",
"sa-east-1",
"us-west-1",
"eu-west-2",
"ap-south-1",
"us-east-2",
"us-west-2",
];
var speedTest = new SpeedTest();
speedTest.AWS.select(regions)
.then(function(sorted) {
for (var i = 0; i < sorted.length; i++) {
const pair = sorted[i];
console.log(pair.region + ' = ' + pair.latency);
}
});
}
//--></script>
<button type="submit" onclick="doSpeedTest();">Run SpeedTest</button>
<p>
In Chrome, press F12 to bring up the Developer Console and switch to the Console tab.e Click on the button to start the AWS speed test.
</p>
</body>
</html>
Install
npm install --save @petervn1/speedtestjs
References
- Amazon EC2 Regions and Zones https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html