MCPcopy Create free account
hub / github.com/FlashpointProject/launcher / recursiveFolderIndex

Function recursiveFolderIndex

src/shared/curate/util.ts:57–76  ·  view source on GitHub ↗
(folderPath: string, basePath: string, content: IndexedContent[])

Source from the content-addressed store, hash-verified

55}
56
57export async function recursiveFolderIndex(folderPath: string, basePath: string, content: IndexedContent[]): Promise<void> {
58 // List all sub-files (and folders)
59 const files = await readdir(folderPath);
60 // Run a promise on each file (and wait for all to finish)
61 for (const fileName of files) {
62 const filePath = path.join(folderPath, fileName);
63 const stats = await lstat(filePath);
64 const isDirectory = stats.isDirectory();
65 // Is a folder, go deeper
66 if (isDirectory) {
67 await recursiveFolderIndex(filePath, basePath, content);
68 // Is a file, add to index
69 } else {
70 content.push({
71 filePath: fixSlashes(path.relative(basePath, filePath)), // Only have one type of slashes
72 fileSize: stats.size,
73 });
74 }
75 }
76}
77
78export async function getTagsFromStr(tagsStr: string, tagCategoriesStr: string): Promise<Tag[]> {
79 const allTags: Tag[] = [];

Callers 1

indexContentFolderFunction · 0.85

Calls 2

fixSlashesFunction · 0.90
pushMethod · 0.65

Tested by

no test coverage detected