Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

138
Views
browser extension latency test

I have a browser extension that sends many requests to a server. I would like to measure how long each request takes. I can use console.log to output it but that makes getting statistics very difficult.

function loadXMLDoc() {  
    var xhttp = new XMLHttpRequest(); 
    var ping = new Date;
    xhttp.open("GET", "http://cors-anywhere.herokuapp.com/blank.org/", false);
    xhttp.setRequestHeader('Cache-Control', 'no-cache');
    xhttp.send();
    if(xhttp.status == 200) {
             ping = new Date - ping;
             console.log('Ping ' + ping + 'ms');
    }
  }

Is it possible to write ping above to a text file like this?

window.requestFileSystem =window.requestFileSystem || window.webkitRequestFileSystem;

window.requestFileSystem(window.PERSISTENT, 0, gotFS, fail);

function gotFS(fileSystem) {
    console.log("gotFS is called" + fileSystem);
    fileSystem.root.getFile("/data/logFile12302021", {create: true}, gotFileEntry, fail);
}

function gotFileEntry(fileEntry) {
    console.log("gotFileEntry:" + fileEntry);
    fileEntry.file(gotFile, fail);
}

function gotFile(file){
    console.log("gotFile");
    //readBinaryString(file);
    readArrayBuffer(file);
}
function fail(){
    console.log("log file creating failed");
}

However I found window.requestFileSytem is deprecated, and I also got window.requestFileSystem is not a function error.

Is there any other way to create and write a text file using JS inside browser extension? I'm using Edge/Chrome.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!