@runejs/core
Version:
Core logging, networking, and buffer functionality for RuneJS applications.
22 lines (21 loc) • 998 B
TypeScript
/**
* A whitelist or blacklist filter for file searching.
*/
export interface FileFilter {
type: 'whitelist' | 'blacklist';
list: string[];
}
/**
* Searches for files within the given directory, using a FileFilter to filter the results if provided.
* Returns an array of paths to the matching files so that they may be imported.
* @param directory The directory to search for files.
* @param filter [optional] The whitelist or blacklist filter to apply to the file search.
*/
export declare function getFiles(directory: string, filter?: FileFilter): AsyncGenerator<string>;
/**
* Searches the given directory for configuration files and converts the results into a
* JSON array of the type T.
* @param configurationDir The directory to search for configuration files.
* @param filter [optional] The file filter to apply to this search.
*/
export declare function loadConfigurationFiles<T = any>(configurationDir: string, filter?: FileFilter): Promise<T[]>;