import IUrlFetcher from './IUrlFetcher'; /** * A utility base class for the `Parser` and `Generator` classes * providing a convenient interface to a filesystem folder and HTTP requests */ export default abstract class Doer { /** * The directory to scan for relevant files */ folder: string; /** * The instance of IUrlFetcher to fetch URLs */ protected readonly urlFetcher: IUrlFetcher; constructor(urlFetcher: IUrlFetcher, folder: string | undefined); /** * Does a path exist within the project folder? * * @param subpath The path within the folder */ exists(subpath: string): boolean; /** * Get a list of paths that match a pattern in the project folder. * * @param pattern The glob pattern */ glob(pattern: string | Array): Array; /** * Read a file within the project folder * * @param subpath The path within the folder */ read(subpath: string): string; /** * Write to a file within the project folder * * @param subpath The path within the folder * @param content The content to write to the file */ write(subpath: string, content: string): void; /** * Fetch content from a URL * * @param url The URL to fetch * @param options Request options */ fetch(url: string, options?: any): Promise; }