1 | import type { Stats, Dirent } from 'fs';
|
2 | import { Readable } from 'stream';
|
3 | export type Path = string;
|
4 | export interface EntryInfo {
|
5 | path: string;
|
6 | fullPath: string;
|
7 | stats?: Stats;
|
8 | dirent?: Dirent;
|
9 | basename: string;
|
10 | }
|
11 | export type PathOrDirent = Dirent | Path;
|
12 | export type Tester = (path: EntryInfo) => boolean;
|
13 | export type Predicate = string[] | string | Tester;
|
14 | declare function defaultOptions(): {
|
15 | root: string;
|
16 | fileFilter: (_path: EntryInfo) => boolean;
|
17 | directoryFilter: (_path: EntryInfo) => boolean;
|
18 | type: string;
|
19 | lstat: boolean;
|
20 | depth: number;
|
21 | alwaysStat: boolean;
|
22 | highWaterMark: number;
|
23 | };
|
24 | export type ReaddirpOptions = ReturnType<typeof defaultOptions>;
|
25 | export interface DirEntry {
|
26 | files: PathOrDirent[];
|
27 | depth: number;
|
28 | path: Path;
|
29 | }
|
30 | export declare class ReaddirpStream extends Readable {
|
31 | parents: any[];
|
32 | reading: boolean;
|
33 | parent?: DirEntry;
|
34 | _stat: Function;
|
35 | _maxDepth: number;
|
36 | _wantsDir: boolean;
|
37 | _wantsFile: boolean;
|
38 | _wantsEverything: boolean;
|
39 | _root: Path;
|
40 | _isDirent: boolean;
|
41 | _statsProp: 'dirent' | 'stats';
|
42 | _rdOptions: {
|
43 | encoding: 'utf8';
|
44 | withFileTypes: boolean;
|
45 | };
|
46 | _fileFilter: Tester;
|
47 | _directoryFilter: Tester;
|
48 | constructor(options?: Partial<ReaddirpOptions>);
|
49 | _read(batch: number): Promise<void>;
|
50 | _exploreDir(path: Path, depth: number): Promise<{
|
51 | files: string[] | undefined;
|
52 | depth: number;
|
53 | path: string;
|
54 | }>;
|
55 | _formatEntry(dirent: PathOrDirent, path: Path): Promise<EntryInfo | undefined>;
|
56 | _onError(err: Error): void;
|
57 | _getEntryType(entry: EntryInfo): Promise<void | "" | "file" | "directory">;
|
58 | _includeAsFile(entry: EntryInfo): boolean | undefined;
|
59 | }
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 | export declare const readdirp: (root: Path, options?: Partial<ReaddirpOptions>) => ReaddirpStream;
|
66 | export declare const readdirpPromise: (root: Path, options?: Partial<ReaddirpOptions>) => Promise<string[]>;
|
67 | export default readdirp;
|