-
Notifications
You must be signed in to change notification settings - Fork 0
IListOptions
hannsolo edited this page May 6, 2020
·
2 revisions
interface IListOptions extends IProgressOptions
export interface IListOptions extends IProgressOptions {
template?: string,
baseDir?: string,
limit?: string,
headers?: string,
recursive?: boolean,
maxRecursiveDepth?: number,
readInternalConnectors?: boolean,
validConnectorTypes?: string | string[],
typeFilter?: ListSortTypeFilterValue,
sort?: ListSortValue,
sortOrder?: ListSortDirectionValue,
fnDirFilter?: (listData: IListData, entry: IListEntry) => Promise<boolean>,
fnFileFilter?: (listData: IListData, entry: IListEntry) => Promise<boolean>,
continueOnError?: boolean,
blackList?: string[],
items?: string[],
generateDirProgress?: boolean
}
- template: string (list template to use)
- recursive: boolean (read subdirectory content)
- maxRecursiveDepth:number (max level of subdirectories to include)
- typeFilter:string ("all" | "file" | "directory")
- sort:string ("FILENAME" | "FILESIZE" | "LASTMODIFIED" | "WIDTH" | "HEIGHT" | "RESOLUTION" | "IMPORTSTATUS")
- sortOrder:string ("asc" | "desc")
- limit:string (read only limited number of entries, e.g. "limit=0,100" to read the first 100 entries only)
- blackList:string[] (array of file paths to exclude)
- fnDirFilter:filterFunction (function to filter entries when recursively reading directory content)
- fnFileFilter:filterFunction (function to filter entries after reading the content recursively)
A filter function receives the listData and a list entry and returns a boolean promise.
fnDirFilter will prevent reading a given subdirectory if the promise resolves with FALSE. The entire subdirectory and its descendants will be skipped.
fnFileFilter will exclude the given entry (directory or file) from the resulting list if resolving with false.
queue.listServer("some/path",
{
recursive:true,
fnDirFilter: (listData, entry) => {
return new Promise((resolve) => {
return resolve(!entry.src.match(/^n/i));
})
}
});
Example excluding all files containing the character "p" from the list using the "fnFileFilter" option
queue.listServer("some/path",
{
recursive:true,
fnFileFilter: (listData, entry) => {
return new Promise((resolve) => {
return resolve(entry.type === "file" && resolve(!entry.src.match(/.*p.*\..*/i)));
})
}
});
Documentation
-
Interfaces