cdp-web
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

cdp-web

This library provides a lightweight way to communicate with the Chrome DevTools Protocol (CDP). Supports browsers, Deno, Node, and Bun. Less than 2KB minified.

import { createCdpConnection } from "cdp-web";

const cdp = await createCdpConnection({
  url: "http://localhost:9222", // optional, default value
  target: "page", // optional, default value
});

// Send 'Tracing.getCategories' command and wait for the result.
const categories = await cdp.send("Tracing.getCategories");

// Listen for all CDP events.
cdp.addEventListener("message", (event) => {
  if (event.method === "Tracing.dataCollected") {
    // Handle 'Tracing.dataCollected' event.
    console.log(event.params);
  }
});

/cdp-web/

    Package Sidebar

    Install

    npm i cdp-web

    Weekly Downloads

    1

    Version

    1.0.3

    License

    UNLICENSED

    Unpacked Size

    9.51 kB

    Total Files

    8

    Last publish

    Collaborators

    • eliassko