MCPcopy Create free account
hub / github.com/codeHappyDananx/SpecWave / getFileType

Function getFileType

electron/main.js:602–632  ·  view source on GitHub ↗
(fileName)

Source from the content-addressed store, hash-verified

600
601// 获取文件类型
602function getFileType(fileName) {
603 const ext = path.extname(fileName).toLowerCase()
604 const typeMap = {
605 '.md': 'markdown',
606 '.js': 'javascript',
607 '.ts': 'typescript',
608 '.vue': 'vue',
609 '.json': 'json',
610 '.yaml': 'yaml',
611 '.yml': 'yaml',
612 '.css': 'css',
613 '.scss': 'scss',
614 '.html': 'html',
615 '.xml': 'xml',
616 '.py': 'python',
617 '.java': 'java',
618 '.sh': 'bash',
619 '.bat': 'batch',
620 '.ps1': 'powershell',
621 '.sql': 'sql',
622 '.txt': 'text',
623 '.log': 'text',
624 '.png': 'image',
625 '.jpg': 'image',
626 '.jpeg': 'image',
627 '.gif': 'image',
628 '.svg': 'image',
629 '.ico': 'image'
630 }
631 return typeMap[ext] || 'text'
632}
633
634function detectTextMeta(buffer) {
635 if (!buffer || buffer.length === 0) {

Callers 2

readDirectoryTreeFunction · 0.85
main.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected