MCPcopy
hub / github.com/promptfoo/promptfoo / isImageFile

Function isImageFile

src/util/fileExtensions.ts:22–26  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

20 * @returns True if the file has an image extension, false otherwise.
21 */
22export function isImageFile(filePath: string): boolean {
23 const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg'];
24 const fileExtension = filePath.split('.').pop()?.toLowerCase() || '';
25 return imageExtensions.includes(fileExtension);
26}
27
28/**
29 * Checks if a file is a video file based on its extension. Non-exhaustive list.

Callers 3

file.test.tsFile · 0.90
collectFileMetadataFunction · 0.90
renderPromptFunction · 0.90

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…