ddsol / speedtest.net

node.js SpeedTest.net client module
MIT License
611 stars 124 forks source link

TypeError: process.hrtime is not a function #56

Closed lovanya closed 6 years ago

lovanya commented 6 years ago

import * as SpeedTest from 'speedtest-net';

let testRun = SpeedTest({maxTime:5000}); testRun.on('testserver', server => { console.dir(server); });

run this in the browser, and it threw an error: TypeError: process.hrtime is not a function

ddsol commented 6 years ago

The speedtest.net module doesn't work in the browser.

lovanya commented 6 years ago

I got it. I added 'process.hrtime = require('browser-process-hrtime')' to index.js and installed the plugin 'browser-process-hrtime'. and it works now