1 |
|
2 |
|
3 |
|
4 |
|
5 | import * as fs from 'fs';
|
6 | import { Readable } from 'stream';
|
7 |
|
8 | declare namespace readdir {
|
9 | interface EntryInfo {
|
10 | path: string;
|
11 | fullPath: string;
|
12 | basename: string;
|
13 | stats?: fs.Stats;
|
14 | dirent?: fs.Dirent;
|
15 | }
|
16 |
|
17 | interface ReaddirpOptions {
|
18 | root?: string;
|
19 | fileFilter?: string | string[] | ((entry: EntryInfo) => boolean);
|
20 | directoryFilter?: string | string[] | ((entry: EntryInfo) => boolean);
|
21 | type?: 'files' | 'directories' | 'files_directories' | 'all';
|
22 | lstat?: boolean;
|
23 | depth?: number;
|
24 | alwaysStat?: boolean;
|
25 | }
|
26 |
|
27 | interface ReaddirpStream extends Readable, AsyncIterable<EntryInfo> {
|
28 | read(): EntryInfo;
|
29 | [Symbol.asyncIterator](): AsyncIterableIterator<EntryInfo>;
|
30 | }
|
31 |
|
32 | function promise(
|
33 | root: string,
|
34 | options?: ReaddirpOptions
|
35 | ): Promise<EntryInfo[]>;
|
36 | }
|
37 |
|
38 | declare function readdir(
|
39 | root: string,
|
40 | options?: readdir.ReaddirpOptions
|
41 | ): readdir.ReaddirpStream;
|
42 |
|
43 | export = readdir;
|
44 |
|
\ | No newline at end of file |