1 | import {Predicate} from '../predicate';
|
2 |
|
3 | import {FileType} from './type';
|
4 |
|
5 | export interface FilesystemBase {
|
6 |
|
7 | name(): string;
|
8 |
|
9 |
|
10 | parent(): PathReference;
|
11 |
|
12 |
|
13 | type(): FileType;
|
14 |
|
15 |
|
16 | exists(): boolean;
|
17 |
|
18 | equals(other: FilesystemBase): boolean;
|
19 | }
|
20 |
|
21 | export interface FileReference extends FilesystemBase {
|
22 |
|
23 | create(content: string): void;
|
24 |
|
25 |
|
26 | content(): string;
|
27 |
|
28 |
|
29 | unlink(): void;
|
30 | }
|
31 |
|
32 | export interface PathReference extends FilesystemBase {
|
33 |
|
34 | directories(predicate?: RegExp | Predicate<PathReference>): Set<PathReference>;
|
35 |
|
36 |
|
37 | files(predicate?: RegExp | Predicate<FileReference>): Set<FileReference>;
|
38 |
|
39 |
|
40 | findInAncestor(file: string): FilesystemBase;
|
41 |
|
42 |
|
43 | mkdir(): void;
|
44 |
|
45 |
|
46 | unlink(): void;
|
47 | }
|