MCPcopy Create free account
hub / github.com/wonderwhy-er/DesktopCommanderMCP / getFileLineCount

Method getFileLineCount

src/utils/files/text.ts:121–132  ·  view source on GitHub ↗

* Get file line count (for files under size limit)

(filePath: string)

Source from the content-addressed store, hash-verified

119 * Get file line count (for files under size limit)
120 */
121 private async getFileLineCount(filePath: string): Promise<number | undefined> {
122 try {
123 const stats = await fs.stat(filePath);
124 if (stats.size < FILE_SIZE_LIMITS.LINE_COUNT_LIMIT) {
125 const content = await fs.readFile(filePath, 'utf8');
126 return TextFileHandler.countLines(content);
127 }
128 } catch (error) {
129 // If we can't read the file, return undefined
130 }
131 return undefined;
132 }
133
134 /**
135 * Generate enhanced status message

Callers 1

Calls 1

countLinesMethod · 0.80

Tested by

no test coverage detected