Web/API/PerformanceResourceTiming/decodedBodySize

From Get docs


The decodedBodySize read-only property returns the size (in octets) received from the fetch (HTTP or cache) of the message body, after removing any applied content-codings. If the resource is retrieved from an application cache or local resources, it returns the size of the payload after removing any applied content-codings.

Note: This feature is available in Web Workers.

Syntax

resource.decodedBodySize;

Return value

The size (in octets) received from the fetch (HTTP or cache) of the message body, after removing any applied content-codings.

Example

The following example, the value of the size properties of all "resource" type events are logged.

function log_sizes(perfEntry){
  // Check for support of the *size properties and print their values
  // if supported.
  if ("decodedBodySize" in perfEntry)
    console.log("decodedBodySize = " + perfEntry.decodedBodySize);
  else
    console.log("decodedBodySize = NOT supported");

  if ("encodedBodySize" in perfEntry)
    console.log("encodedBodySize = " + perfEntry.encodedBodySize);
  else
    console.log("encodedBodySize = NOT supported");

  if ("transferSize" in perfEntry)
    console.log("transferSize = " + perfEntry.transferSize);
  else
    console.log("transferSize = NOT supported");
}
function check_PerformanceEntries() {
  // Use getEntriesByType() to just get the "resource" events
  var p = performance.getEntriesByType("resource");
  for (var i=0; i < p.length; i++) {
    log_sizes(p[i]);
  }
}

Specifications

Specification Status Comment
Resource Timing Level 2The definition of 'decodedBodySize' in that specification. Working Draft Initial definition.

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
decodedBodySize Chrome

Full support 54

Edge

Full support 17

Firefox

Full support 45

IE

No support No

Opera

Full support 41

Safari

No support No

WebView Android

Full support 54

Chrome Android

Full support 54

Firefox Android

Full support 45

Opera Android

Full support 41

Safari iOS

No support No

Samsung Internet Android

Full support 6.0

Legend

Full support  
Full support
No support  
No support