(fileName)
| 600 | |
| 601 | // 获取文件类型 |
| 602 | function 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 | |
| 634 | function detectTextMeta(buffer) { |
| 635 | if (!buffer || buffer.length === 0) { |
no outgoing calls
no test coverage detected