MCPcopy Create free account
hub / github.com/ZingerLittleBee/ServerBee / isTextFile

Function isTextFile

apps/web/src/lib/file-utils.ts:106–125  ·  view source on GitHub ↗
(filename: string)

Source from the content-addressed store, hash-verified

104}
105
106export function isTextFile(filename: string): boolean {
107 const baseName = getBaseName(filename)
108
109 // Special filenames that are text
110 if (
111 baseName === 'dockerfile' ||
112 baseName === 'makefile' ||
113 baseName === 'gnumakefile' ||
114 baseName === '.gitignore' ||
115 baseName === '.gitattributes' ||
116 baseName === '.editorconfig' ||
117 baseName === '.env' ||
118 baseName.startsWith('.env.')
119 ) {
120 return true
121 }
122
123 const ext = getExtension(filename)
124 return TEXT_EXTENSIONS.has(ext)
125}
126
127export function isImageFile(filename: string): boolean {
128 const ext = getExtension(filename)

Callers 3

FilePreviewFunction · 0.90
file-utils.test.tsFile · 0.90
fileIconFunction · 0.85

Calls 2

getBaseNameFunction · 0.85
getExtensionFunction · 0.85

Tested by

no test coverage detected