MCPcopy Create free account
hub / github.com/promptfoo/promptfoo / getExtensionType

Function getExtensionType

src/codeScan/git/diffProcessor.ts:297–309  ·  view source on GitHub ↗

* Check file extension against known text and binary extension lists * @returns 'text' if known text extension, 'binary' if known binary extension, 'unknown' otherwise

(filePath: string)

Source from the content-addressed store, hash-verified

295 * @returns 'text' if known text extension, 'binary' if known binary extension, 'unknown' otherwise
296 */
297function getExtensionType(filePath: string): 'text' | 'binary' | 'unknown' {
298 const ext = path.extname(filePath).toLowerCase().slice(1); // Remove leading dot
299
300 if (textExtensions.includes(ext)) {
301 return 'text';
302 }
303
304 if (binaryExtensions.includes(ext)) {
305 return 'binary';
306 }
307
308 return 'unknown';
309}
310
311/**
312 * Determine text/binary status for a single file

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…