The encodedBodySize
read-only property represents the size (in octets) received from the fetch (HTTP or cache), of the payload body, before removing any applied content-codings.
If the resource is retrieved from an application cache or a local resource, it must return the size of the payload body before removing any applied content-codings.
A number
representing the size (in octets) received from the fetch (HTTP or cache), of the payload body, before removing any applied content-codings.
The following example, the value of the size properties of all "resource
" type
events are logged.
function log_sizes(perfEntry){
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() {
var p = performance.getEntriesByType("resource");
for (var i=0; i < p.length; i++) {
log_sizes(p[i]);
}
}