Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

112
Vistas
How to get the amount of transferred data during a session with the help of an extension?

In a extension I am building, I need to get all the transfer data sizes of all website I am going to visit after clicking on a button. At the end, I will show to total amount of data transferred during one session of test.

Currently in the extension, when I press the button "start", it is going to call some functions from a background.js including adding some listeners. These listeners will be stopped when the user will click on "stop button.

Here is the function called by the listener inside the background file.

function getDataTransferredSize(){
  var sum = 0;
  if (window.performance === undefined) {
    console.log("= Display Size Data: performance NOT supported");
    return;
  }
  var list = window.performance.getEntriesByType("resource");
  if (list === undefined) {
    console.log("= Display Size Data: performance.getEntriesByType() is  NOT supported");
    return;
  }
  console.log("= Display Size Data");
  for (var i=0; i < list.length; i++) {
    if ("transferSize" in list[i]) {
      console.log("... transferSize[" + i + "] = " + list[i].transferSize);
      sum = sum + list[i].transferSize;
    }
    else
      console.log("... transferSize[" + i + "] = NOT supported");
  }
  totalDataTransferredSize += sum;
  console.log("Data transf : " + totalDataTransferredSize)
}

the problem is it does not sum up all the sizes of transferred data in each webpage where the extension is opened but it is doing it in the context of the extension. I could not manage to get the sizes outside the extension. Do you have any idea on how to do it ?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda