tiny-readdir-glob
Version:
A simple promisified recursive readdir function, with support for globs.
21 lines (20 loc) • 620 B
TypeScript
import type { Dirent, DirentLike } from 'tiny-readdir';
type ArrayMaybe<T> = T[] | T;
type PromiseMaybe<T> = Promise<T> | T;
type Options = {
cwd?: string;
depth?: number;
limit?: number;
followSymlinks?: boolean;
ignore?: ArrayMaybe<((targetPath: string, targetContext: DirentLike) => boolean) | RegExp | string>;
signal?: {
aborted: boolean;
};
onDirents?: (dirents: Dirent[]) => PromiseMaybe<undefined>;
};
type Result = {
directories: string[];
files: string[];
symlinks: string[];
};
export type { ArrayMaybe, PromiseMaybe, Dirent, DirentLike, Options, Result };