← Back to Audits domain

Audits.getEncodedResponse

Returns the response body and size if it were re-encoded with the specified settings. Only applies to images.

Domain: Audits experimental

Parameters

NameTypeDescription
requestIdNetwork.RequestIdIdentifier of the network request to get content for.
encodingstringThe encoding to use.
quality (optional)numberThe quality of the encoding (0-1). (defaults to 1)
sizeOnly (optional)booleanWhether to only return the size information (defaults to false).

Returns

NameTypeDescription
bodystringThe encoded body as a base64 string. Omitted if sizeOnly is true. (Encoded as a base64 string when passed over JSON)
originalSizeintegerSize before re-encoding.
encodedSizeintegerSize after re-encoding.

Example Request

{
  "id": 1,
  "method": "Audits.getEncodedResponse",
  "params": {
    "requestId": "request-1",
    "encoding": "encoding-value"
  }
}

Example Response

{
  "id": 1,
  "result": {
    "body": "body-value",
    "originalSize": 1,
    "encodedSize": 1
  }
}

Usage in Node.js

const result = await send('Audits.getEncodedResponse', {"requestId": "request-1", "encoding": "encoding-value"});
console.log(result);
// {"body": "body-value", "originalSize": 1, "encodedSize": 1}