scan

Bun

Symbol

Glob.scan

scan(optionsOrCwd?: string | GlobScanOptions): AsyncIterableIterator<string>

Scan a root directory recursively for files that match this glob pattern. Returns an async iterator.

const glob = new Glob("*.{ts,tsx}");
const scannedFiles = await Array.fromAsync(glob.scan({ cwd: './src' }))

Referenced types

interface GlobScanOptions

  • absolute?: boolean

    Return the absolute path for entries.

  • cwd?: string

    The root directory to start matching from. Defaults to process.cwd()

  • dot?: boolean

    Allow patterns to match entries that begin with a period (.).

  • onlyFiles?: boolean

    Return only files.