cloudflare / speedtest

Component to perform network speed tests against Cloudflare's edge network
https://speed.cloudflare.com
MIT License
459 stars 34 forks source link

Feature Request: Add support for Deno #32

Open NfNitLoop opened 8 months ago

NfNitLoop commented 8 months ago

Sample code:

import { default as CFSpeedTest, ConfigOptions } from "npm:@cloudflare/speedtest@1.3.0"

async function main() {
    const opts: ConfigOptions = {
    }
    const test = new CFSpeedTest(opts)
    test.onFinish = (results) => {
        console.log(results)
    }
}

if (import.meta.main) {
    await main()
}

Output:

✅ Granted read access to "C:\Users\codyc\AppData\Local\deno\npm\node_modules".
✅ Granted read access to "C:\Users\codyc\AppData\Local\deno\node_modules".
✅ Granted read access to "C:\Users\codyc\AppData\Local\node_modules".
✅ Granted read access to "C:\Users\codyc\AppData\node_modules".
✅ Granted read access to "C:\Users\codyc\node_modules".
✅ Granted read access to "C:\Users\node_modules".
✅ Granted read access to "C:\node_modules".
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=100000: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=100000: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?during=download&bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=100000: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?bytes=100000: TypeError: Cannot read properties of undefined (reading 'transferSize')
Error fetching https://speed.cloudflare.com/__down?during=download&bytes=0: TypeError: Cannot read properties of undefined (reading 'transferSize')
[etc.]
jsejcksn commented 3 weeks ago

Ref: PerformanceResourceTiming: transferSize property — the Performance API is not yet fully implemented in Deno. See this related tracking issue: