t-comm
Version:
专业、稳定、纯粹的工具库
46 lines (45 loc) • 1.6 kB
TypeScript
export declare function mkDirsSync(dirname: string): true | undefined;
/**
* 拷贝目录以及子文件
* @param {Object} src
* @param {Object} dist
* @param {Object} callback
*/
export declare function copyDir(src: string, dist: string, callback?: Function): void;
/**
* 删除目录
* @param {Object} path
*/
export declare function deleteFolder(tPath: string): void;
/**
* 递归删除空目录
* @param path 路径
* @param level 层级
*/
export declare function rmEmptyDir(tPath: string, level?: number): void;
export declare function deleteFolderRecursive(path: string, options?: {
deleteFile: boolean;
log: boolean;
}): void;
/**
* 拷贝文件
* @param {Object} from 文件来自那里
* @param {Object} to 拷贝到那里
*/
export declare function copyFile(from: string, to: string): void;
/**
* 递归遍历文件夹,并执行某操作
* @param {Function} cb 回调参数
* @param {String} path 文件夹或文件路径
*/
export declare function traverseFolder(cb: Function, tPath: string): void;
export declare function readJsonLog(file: string, defaultContent?: string): any;
export declare function getJsonLogDir(): string;
export declare function saveJsonToLog(content: object, file: string, needLog?: boolean): void;
export declare function saveJsonToLogMore(content: any, file: string, options?: {
needLog?: boolean;
max?: number;
}): void;
export declare function getJsonFromLog(file: string): {};
export declare function getFileName(file: string): string;
export declare function readJson(content: string, file: string): Record<string, any>;