MCPcopy Create free account
hub / github.com/EmNudge/watlings / getFilesInFolder

Function getFilesInFolder

tests/_meta/patch.test.js:10–22  ·  view source on GitHub ↗
(relativePath)

Source from the content-addressed store, hash-verified

8
9/** @param {string} relativePath */
10const getFilesInFolder = async (relativePath) => {
11 const folderPath = fileURLToPath(new URL(relativePath, import.meta.url));
12 const folderFiles = await readdir(folderPath);
13
14 const fileReads = folderFiles
15 .map((name) => [name, path.resolve(folderPath, name)])
16 .map(async ([name, path]) => ({
17 name,
18 content: await readFile(path, "utf-8"),
19 }));
20
21 return Promise.all(fileReads);
22};
23
24/** @returns {Promise<Map<string, { exercise: string, patch?: string }>>} */
25const getPatchMap = async () => {

Callers 1

getPatchMapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected