ooafs
Version:
Type-safe Object-Oriented Async FileSystem
30 lines (29 loc) • 839 B
TypeScript
import Entry from './Entry';
import EntryType from './EntryType';
/**
* Used to define a filter for filesystem entries. All properties are optionnal.
*/
interface EntryFilter {
/**
* Restrict the entry to a specific type
*/
type?: EntryType;
/**
* Only match one or more extensions. The dot may be omitted
*/
extensions?: string[];
/**
* Custom filtering function. The function can be asynchroneous
* @param entry
*/
filter?(entry: Entry): boolean | Promise<boolean>;
}
declare namespace EntryFilter {
/**
* Checks if a filesystem entry matches a given filter
* @param entry - Filesystem entry to test against the filter
* @param filter - Filter
*/
function matches(entry: Entry, filter: EntryFilter): Promise<boolean>;
}
export default EntryFilter;