@freik/node-utils
Version:
My personal set of utilities for NodeJS
27 lines (26 loc) • 1.26 kB
TypeScript
export type ForDirsOptions = {
keepGoing: boolean;
order: 'breadth' | 'depth';
skipHiddenFolders: boolean;
dontAssumeDotsAreHidden: boolean;
dontFollowSymlinks: boolean;
recurse: boolean | ((dirName: string) => Promise<boolean> | boolean);
};
export type ForFilesCommonOptions = {
keepGoing: boolean;
fileTypes: string[] | string;
order: 'breadth' | 'depth';
skipHiddenFiles: boolean;
skipHiddenFolders: boolean;
dontAssumeDotsAreHidden: boolean;
dontFollowSymlinks: boolean;
};
export type ForFilesSyncOptions = {
recurse: boolean | ((dirName: string) => boolean);
} & ForFilesCommonOptions;
export type ForFilesOptions = {
recurse: boolean | ((dirName: string) => Promise<boolean> | boolean);
} & ForFilesCommonOptions;
export declare function ForFiles(seed: string | string[], func: (fileName: string) => Promise<boolean> | boolean, opts?: Partial<ForFilesOptions>): Promise<boolean>;
export declare function ForFilesSync(seed: string | string[], func: (fileName: string) => boolean, opts?: Partial<ForFilesSyncOptions>): boolean;
export declare function ForDirs(seed: string | string[], dirProcessor: (dirName: string) => Promise<boolean> | boolean, opts?: Partial<ForDirsOptions>): Promise<boolean>;