Skip to content
Mopsgamer edited this page Aug 22, 2026 · 1 revision

Scan Option: skipDepth

The skipDepth option works in conjunction with ScanOptions.depth to optimize shallow directory traversal.

Type Signature & Default

skipDepth?: boolean
  • Default: false

What It Does

When depth is specified and skipDepth is true, view-ignored skips evaluating remaining directory child entries as soon as the maximum depth threshold is reached, bypassing deeper statistical directory walking.

Why Use / Why Not Use

Why Use

  • High Speed: Accelerates shallow scans by omitting deep directory status calculations.

Why Not Use

  • Stats Impact: Affects MatcherContext.totalDirs, MatcherContext.totalFiles, MatcherContext.totalMatchedFiles, and MatcherContext.depthPaths. Do not use if exact file/directory counters for skipped subdirectories are required.

Code Examples

Example 1: High Performance Shallow Scan

import * as vign from "view-ignored"
import { makeGit } from "view-ignored/targets"

const ctx = await vign.scan({
	target: makeGit(),
	depth: 2,
	skipDepth: true,
})

Example 2: Progressive Tree Explorer (Depth 1 with skipDepth)

const ctx = await vign.scan({
	target: makeGit(),
	depth: 1,
	skipDepth: true,
})

Related Wiki Pages

Clone this wiki locally