MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / files

Function files

src/lib/fileList.js:117–135  ·  view source on GitHub ↗
(dir)

Source from the content-addressed store, hash-verified

115 * @returns {Tree[]}
116 */
117export default function files(dir) {
118 const listedDirs = [];
119 let transform = (item) => item;
120 if (typeof dir === "string") {
121 for (const item of Object.values(filesTree)) {
122 const found = getFile(dir, item);
123 if (found) return found;
124 }
125 return null;
126 } else if (typeof dir === "function") {
127 transform = dir;
128 }
129
130 const allFiles = [];
131 Object.values(filesTree).forEach((item) => {
132 allFiles.push(...flattenTree(item, transform, listedDirs));
133 });
134 return allFiles;
135}
136
137/**
138 * @typedef {'add-file'|'push-file'|'remove-file'|'add-folder'|'remove-folder'|'refresh'} FileListEvent

Callers

nothing calls this directly

Calls 2

flattenTreeFunction · 0.85
getFileFunction · 0.70

Tested by

no test coverage detected