scanSync

Bun

Symbol

Glob.scanSync

scanSync(optionsOrCwd?: string | GlobScanOptions): IterableIterator<string>

Synchronously scan a root directory recursively for files that match this glob pattern. Returns an iterator.

const glob = new Glob("*.{ts,tsx}");
const scannedFiles = Array.from(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.