MCPcopy Create free account
hub / github.com/Crain99/cc-reverse / readDirectory

Function readDirectory

src/utils/fileManager.js:43–50  ·  view source on GitHub ↗

* 读取目录内容 * @param {string} directory 目录路径 * @returns {Promise } 文件名列表

(directory)

Source from the content-addressed store, hash-verified

41 * @returns {Promise<string|Buffer>} 文件内容
42 */
43 async readFile(filePath, encoding = 'utf-8') {
44 try {
45 return await fsp.readFile(filePath, encoding === null ? undefined : encoding);
46 } catch (err) {
47 logger.error(`读取文件 ${filePath} 时出错:`, err);
48 throw err;
49 }
50 },
51
52 /**
53 * 写入文件

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected