01 · Install
Pin the package in the application.
terminal
npm install cockroach-crawler
02 · Execute
Use crawlDetailed when failures matter.
crawl.mjs
import { crawlDetailed } from "cockroach-crawler";
const controller = new AbortController();
const result = await crawlDetailed({
seeds: ["https://example.com/docs"],
allowedOrigins: ["https://example.com"],
maxPages: 25,
maxRequests: 120,
maxDepth: 2,
maxDurationMs: 60_000,
maxTotalBytes: 10_000_000,
includeSitemaps: true,
signal: controller.signal
});
console.log(result.pages);
console.log(result.failures);
console.log(result.stats);
03 · Handle
Treat a partial crawl as an explicit state.
Inspect failures and stats before indexing. Keep page URLs and hashes beside derived chunks, and keep crawled text in a data channel because page content is untrusted.