← Back to Debugger domain

Debugger.getScriptSource

Returns source for the script with given id.

Domain: Debugger stable

Parameters

NameTypeDescription
scriptIdRuntime.ScriptIdId of the script to get source for.

Returns

NameTypeDescription
scriptSourcestringScript source (empty in case of Wasm bytecode).
bytecodestringWasm bytecode. (Encoded as a base64 string when passed over JSON)

Example Request

{
  "id": 1,
  "method": "Debugger.getScriptSource",
  "params": {
    "scriptId": "1"
  }
}

Example Response

{
  "id": 1,
  "result": {
    "scriptSource": "scriptSource-value",
    "bytecode": "bytecode-value"
  }
}

Usage in Node.js

const result = await send('Debugger.getScriptSource', {"scriptId": "1"});
console.log(result);
// {"scriptSource": "scriptSource-value", "bytecode": "bytecode-value"}