MCPcopy Create free account
hub / github.com/CatMuse/HiNote / toSafeFileName

Method toSafeFileName

src/storage/FilePathUtils.ts:10–16  ·  view source on GitHub ↗

* 将文件路径转换为安全的文件名 * @param filePath 原始文件路径 * @returns 安全的文件名

(filePath: string)

Source from the content-addressed store, hash-verified

8 * @returns 安全的文件名
9 */
10 static toSafeFileName(filePath: string): string {
11 return filePath
12 .replace(/[/\\:*?"<>|]/g, '_') // 替换特殊字符
13 .replace(/\s+/g, '_') // 替换空格
14 .toLowerCase() // 转小写
15 + '.json';
16 }
17
18 /**
19 * 从安全文件名恢复原始路径(需要配合映射文件)

Callers 1

getStoragePathForFileMethod · 0.80

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected