2023-11-12 22:00:29 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 获取文件的后缀名
|
|
|
|
|
|
* @param fileName 文件名
|
|
|
|
|
|
* @returns 文件后缀名
|
|
|
|
|
|
*/
|
|
|
|
|
|
export declare function getFileExt(fileName: string): string;
|
|
|
|
|
|
/**
|
2023-11-14 16:17:22 +08:00
|
|
|
|
* 获取文件全名(包含扩展名)
|
2023-11-12 22:00:29 +08:00
|
|
|
|
* 该函数接收一个表示文件路径的字符串作为参数,返回该路径中文件名部分。
|
|
|
|
|
|
* 首先查找路径中最后一个斜杠或反斜杠的索引,若未找到则直接返回路径;
|
|
|
|
|
|
* 若找到,则使用substring方法提取最后一个斜杠或反斜杠后面的字符串作为文件名并返回。
|
|
|
|
|
|
* @param path 文件路径
|
2023-11-14 16:17:22 +08:00
|
|
|
|
* @returns 文件全名(包含扩展名)
|
2023-11-12 22:00:29 +08:00
|
|
|
|
*/
|
2023-11-14 16:17:22 +08:00
|
|
|
|
export declare function getFileFullName(path: string): string;
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取文件名不包含扩展名
|
|
|
|
|
|
*/
|
|
|
|
|
|
export declare function getFileNameWithoutExt(path: string): string;
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 文件信息
|
|
|
|
|
|
*/
|
|
|
|
|
|
export interface IFileInfo {
|
|
|
|
|
|
/** 文件名(包含扩展名) */
|
|
|
|
|
|
fileName: string;
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 文件名不带扩展名
|
|
|
|
|
|
*/
|
|
|
|
|
|
fileNameNoExt: string;
|
|
|
|
|
|
/** 文件扩展名 */
|
|
|
|
|
|
fileExtName: string;
|
|
|
|
|
|
/** 路径仅包含文件夹 */
|
|
|
|
|
|
pathOnly: string;
|
|
|
|
|
|
/** 完整路径 */
|
|
|
|
|
|
fullPath: string;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取文件信息
|
|
|
|
|
|
* @param path 文件路径
|
|
|
|
|
|
* @param platform 平台名称,默认为"win32"
|
|
|
|
|
|
* @returns 包含文件名、文件名不带扩展名、文件扩展名、路径仅包含文件夹、完整路径的对象
|
|
|
|
|
|
*/
|
|
|
|
|
|
export declare function getFileInfo(path: string, platform?: string): IFileInfo;
|