this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove 10kB test

10kB test speed was skewing the final download speed

+23 -40
+23 -40
cli.js
··· 220 220 221 221 async function speedTest() { 222 222 const serverLocationData = await fetchServerLocationData(); 223 - 224 223 const { ip, loc, colo } = await fetchCfCdnCgiTrace(); 225 - 226 224 const city = serverLocationData[colo]; 227 - 228 225 logInfo('Server location', `${city} (${colo})`); 229 226 logInfo('Your IP', `${ip} (${loc})`); 230 227 231 228 const ping = await measureLatency(); 232 - 233 229 console.log(bold(' Latency:', magenta(`${ping[3].toFixed(2)} ms`))); 234 230 235 - const test1 = await measureDownload(11000, 10); 236 - 237 - logSpeedTestResult('10kB', test1); 238 - 239 - const test2 = await measureDownload(101000, 10); 240 - 241 - logSpeedTestResult('100kB', test2); 231 + const testDown1 = await measureDownload(101000, 10); 232 + logSpeedTestResult('100kB', testDown1); 242 233 243 - const test3 = await measureDownload(1001000, 8); 234 + const testDown2 = await measureDownload(1001000, 8); 235 + logSpeedTestResult('1MB', testDown2); 244 236 245 - logSpeedTestResult('1MB', test3); 237 + const testDown3 = await measureDownload(10001000, 5); 238 + logSpeedTestResult('10MB', testDown3); 246 239 247 - const test4 = await measureDownload(10001000, 5); 240 + const testDown4 = await measureDownload(25001000, 5); 241 + logSpeedTestResult('25MB', testDown4); 248 242 249 - logSpeedTestResult('10MB', test4); 243 + const testDown5 = await measureDownload(100001000, 5); 244 + logSpeedTestResult('100MB', testDown5); 250 245 251 - const test5 = await measureDownload(25001000, 5); 252 - 253 - logSpeedTestResult('25MB', test5); 254 - 255 - const test6 = await measureDownload(100001000, 5); 256 - 257 - logSpeedTestResult('100MB', test6); 258 - 246 + const downloadTests = [ 247 + ...testDown1, 248 + ...testDown2, 249 + ...testDown3, 250 + ...testDown4, 251 + ...testDown5, 252 + ]; 259 253 console.log( 260 254 bold( 261 255 ' Download speed:', 262 - green( 263 - stats 264 - .quartile( 265 - [...test1, ...test2, ...test3, ...test4, ...test5, ...test6], 266 - 0.9 267 - ) 268 - .toFixed(2), 269 - 'Mbps' 270 - ) 256 + green(stats.quartile(downloadTests, 0.9).toFixed(2), 'Mbps') 271 257 ) 272 258 ); 273 259 274 - const test7 = await measureUpload(11000, 10); 275 - const test8 = await measureUpload(101000, 10); 276 - const test9 = await measureUpload(1001000, 8); 277 - 260 + const testUp1 = await measureUpload(11000, 10); 261 + const testUp2 = await measureUpload(101000, 10); 262 + const testUp3 = await measureUpload(1001000, 8); 263 + const uploadTests = [...testUp1, ...testUp2, ...testUp3]; 278 264 console.log( 279 265 bold( 280 266 ' Upload speed:', 281 - green( 282 - stats.quartile([...test7, ...test8, ...test9], 0.9).toFixed(2), 283 - 'Mbps' 284 - ) 267 + green(stats.quartile(uploadTests, 0.9).toFixed(2), 'Mbps') 285 268 ) 286 269 ); 287 270 }