Inspector

inspector.Session.post()

Dispatches a DevTools protocol operation. The method is a protocol command, not an arbitrary user-defined function. Only fixed diagnostic commands should be used in a trusted lab. This lab uses an in-process session with no exposed debugger port. Never expose a debugger to untrusted clients. Tested on Node.js 22.16.0. Example output (one line per entry): ["true true"].

Formal Syntax & Structure

nodejs syntaxnodejs
session.post(method[, params][, callback])

Parameters & Attributes

NameTypeDescription
methodstringProtocol method.
paramsobjectMethod parameters.
callbackFunctionResult handler.

Return Value

undefined

Dispatches the operation.

Working Example

Example Snippetnodejs
import { Session } from 'node:inspector';import { promisify } from 'node:util';const s = new Session();s.connect();try {    const post = promisify(s.post.bind(s));    const r = await post('Runtime.getHeapUsage');    console.log(r.usedSize > 0, r.totalSize >= r.usedSize);}finally {    s.disconnect();}
Node.js Reference