| 354 | } |
| 355 | |
| 356 | function summarizeNode( |
| 357 | node: StateTreeNode, |
| 358 | depth: number, |
| 359 | summary: StateTreeSummary |
| 360 | ): void { |
| 361 | summary.maxDepth = Math.max(summary.maxDepth, depth); |
| 362 | if (node.type === "file") { |
| 363 | summary.files++; |
| 364 | summary.totalBytes += node.size; |
| 365 | } else if (node.type === "directory") { |
| 366 | summary.directories++; |
| 367 | } else { |
| 368 | summary.symlinks++; |
| 369 | } |
| 370 | for (const child of node.children ?? []) { |
| 371 | summarizeNode(child, depth + 1, summary); |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | async function visitFind( |
| 376 | path: string, |