Track the data transfers size

Is there a way to track how much data has been transferred on a request ?

For a code like this :

let response = await fetch(‘some big video file’);
return new Response(response.body)

Can i track how much of the body the browser receives. Or if the browser kills the connection ?

Is there a way to do this ?

You have to use waitUntil to asynchronously log data to 3rd party even after response has been delivered.Check out Logs from the Edge for an example.

I do not think waitUntil is what i am looking for, my issue is like this :

Someone stars to download a file, what i want to find out is if there is a way to know how many bytes has been passed to the browser.

Also, is there a way to know if the browser kills the connection before all the data is passed to it ?