1 | import IUrlFetcher from './IUrlFetcher';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | export default abstract class Doer {
|
7 | |
8 |
|
9 |
|
10 | folder: string;
|
11 | |
12 |
|
13 |
|
14 | protected readonly urlFetcher: IUrlFetcher;
|
15 | constructor(urlFetcher: IUrlFetcher, folder: string | undefined);
|
16 | /**
|
17 | * Does a path exist within the project folder?
|
18 | *
|
19 | * @param subpath The path within the folder
|
20 | */
|
21 | exists(subpath: string): boolean;
|
22 | /**
|
23 | * Get a list of paths that match a pattern in the project folder.
|
24 | *
|
25 | * @param pattern The glob pattern
|
26 | */
|
27 | glob(pattern: string | Array<string>): Array<string>;
|
28 | /**
|
29 | * Read a file within the project folder
|
30 | *
|
31 | * @param subpath The path within the folder
|
32 | */
|
33 | read(subpath: string): string;
|
34 | /**
|
35 | * Write to a file within the project folder
|
36 | *
|
37 | * @param subpath The path within the folder
|
38 | * @param content The content to write to the file
|
39 | */
|
40 | write(subpath: string, content: string): void;
|
41 | /**
|
42 | * Fetch content from a URL
|
43 | *
|
44 | * @param url The URL to fetch
|
45 | * @param options Request options
|
46 | */
|
47 | fetch(url: string, options?: any): Promise<any>;
|
48 | }
|