import { Stats } from "node:fs"; /** * Callback * * Extension starts with '.' (can be empty) * File does not include extension * Subdir ends with '/' (can be empty) * * Should return: * - false, null or undefined to skip file * - true to include file (subdir + file + extension) * - string to include custom string (such as file without extension) * - custom object to return custom object */ type ScanDirectoryCallbackFalseResult = boolean | null | undefined; type ScanDirectoryCallbackStringResult = ScanDirectoryCallbackFalseResult | string; type Callback = (ext: string, file: string, subdir: string, path: string, stat: Stats) => T; type AsyncCallback = Callback>; type ScanDirectoryCallback = AsyncCallback; type ScanDirectorySyncCallback = Callback; /** * Find all files in directory */ declare function scanDirectory(path: string, callback?: AsyncCallback, subdirs?: boolean): Promise; declare function scanDirectory(path: string, callback: AsyncCallback, subdirs?: boolean): Promise; /** * Find all files in directory, synchronously */ declare function scanDirectorySync(path: string, callback?: Callback, subdirs?: boolean): string[]; declare function scanDirectorySync(path: string, callback: Callback, subdirs?: boolean): T[]; export { ScanDirectoryCallback, ScanDirectorySyncCallback, scanDirectory, scanDirectorySync };