.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / @mrmlnc / readdir-enhanced / types.d.ts
1 /// <reference types="node" />
2
3 import fs = require('fs');
4
5 declare namespace re {
6     interface Entry extends fs.Stats {
7         path: string;
8         depth: number;
9     }
10
11     type FilterFunction = (stat: Entry) => boolean;
12     type Callback<T> = (err: NodeJS.ErrnoException, result: T) => void;
13     type CallbackString = Callback<string[]>;
14     type CallbackEntry = Callback<Entry[]>;
15
16     interface FileSystem {
17         readdir?: (path: string, callback: Callback<string[]>) => void;
18         lstat?: (path: string, callback: Callback<fs.Stats>) => void;
19         stat?: (path: string, callback: Callback<fs.Stats>) => void;
20     }
21
22     interface Options {
23         filter?: string | RegExp | FilterFunction;
24         deep?: boolean | number | RegExp | FilterFunction;
25         sep?: string;
26         basePath?: string;
27         fs?: FileSystem;
28     }
29
30     function stat(root: string, options?: Options): Promise<Entry[]>;
31     function stat(root: string, callback: CallbackEntry): void;
32     function stat(root: string, options: Options, callback: CallbackEntry): void;
33
34     function async(root: string, options?: Options): Promise<string[]>;
35     function async(root: string, callback: CallbackString): void;
36     function async(root: string, options: Options, callback: CallbackString): void;
37
38     function readdirAsyncStat(root: string, options?: Options): Promise<Entry[]>;
39     function readdirAsyncStat(root: string, callback: CallbackEntry): void;
40     function readdirAsyncStat(root: string, options: Options, callback: CallbackEntry): void;
41
42     namespace async {
43         function stat(root: string, options?: Options): Promise<Entry[]>;
44         function stat(root: string, callback: CallbackEntry): void;
45         function stat(root: string, options: Options, callback: CallbackEntry): void;
46     }
47
48     function stream(root: string, options?: Options): NodeJS.ReadableStream;
49     function readdirStreamStat(root: string, options?: Options): NodeJS.ReadableStream;
50
51     namespace stream {
52         function stat(root: string, options?: Options): NodeJS.ReadableStream;
53     }
54
55     function sync(root: string, options?: Options): string[];
56     function readdirSyncStat(root: string, options?: Options): Entry[];
57
58     namespace sync {
59         function stat(root: string, options?: Options): Entry[];
60     }
61 }
62
63 declare function re(root: string, options?: re.Options): Promise<string[]>;
64 declare function re(root: string, callback: re.CallbackString): void;
65 declare function re(root: string, options: re.Options, callback: re.CallbackString): void;
66
67 export = re;