1 | export interface FS {
|
2 | /** check if a file exists asynchronously */
|
3 | exists: (filepath: string) => Promise<boolean>;
|
4 | /** check if a file exists synchronously */
|
5 | existsSync: (filepath: string) => boolean;
|
6 | /** read a file asynchronously */
|
7 | readFile: (filepath: string) => Promise<string>;
|
8 | /** read a file synchronously */
|
9 | readFileSync: (filepath: string) => string;
|
10 | /** resolve a file against directory, for given `ext` option */
|
11 | resolve: (dir: string, file: string, ext: string) => string;
|
12 | /** check if file is contained in `root`, always return `true` by default. Warning: not setting this could expose path traversal vulnerabilities. */
|
13 | contains?: (root: string, file: string) => boolean;
|
14 | /** defaults to "/" */
|
15 | sep?: string;
|
16 | /** required for relative path resolving */
|
17 | dirname?: (file: string) => string;
|
18 | /** fallback file for lookup failure */
|
19 | fallback?: (file: string) => string | undefined;
|
20 | }
|