MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / sniffAll

Method sniffAll

packages/parser/src/sniffer.ts:125–137  ·  view source on GitHub ↗

* 嗅探所有匹配的格式(按优先级排序) * 用于 fallback 机制:当第一个格式解析失败时尝试下一个 * @param filePath 文件路径 * @returns 所有匹配的格式特征列表

(filePath: string)

Source from the content-addressed store, hash-verified

123 * @returns 所有匹配的格式特征列表
124 */
125 sniffAll(filePath: string): FormatFeature[] {
126 const ext = getExtension(filePath)
127 const headContent = readFileHead(filePath)
128 const results: FormatFeature[] = []
129
130 for (const { feature } of this.formats) {
131 if (this.matchFeature(feature, ext, headContent, filePath)) {
132 results.push(feature)
133 }
134 }
135
136 return results
137 }
138
139 /**
140 * 获取所有匹配的解析器(按优先级排序)

Callers 1

detectAllFormatsFunction · 0.80

Calls 3

matchFeatureMethod · 0.95
getExtensionFunction · 0.85
readFileHeadFunction · 0.85

Tested by

no test coverage detected