MCPcopy Create free account
hub / github.com/MiniMax-AI/OpenRoom / deleteFile

Function deleteFile

apps/webuiapps/src/lib/localFileApi.ts:129–154  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

127 };
128
129 const deleteFile = async (path: string): Promise<void> => {
130 const normalizedPath = normalizePath(path);
131 const node = findNodeByPath(normalizedPath);
132
133 if (!node) {
134 throw new Error(`File not found: ${path}`);
135 }
136
137 if (node.parentId) {
138 const parentNode = store.get(node.parentId);
139 if (parentNode && parentNode.children) {
140 parentNode.children = parentNode.children.filter((id) => id !== node.id);
141 }
142 }
143
144 if (node.type === 'folder' && node.children) {
145 for (const childId of node.children) {
146 const child = store.get(childId);
147 if (child) {
148 await deleteFile(child.path);
149 }
150 }
151 }
152
153 store.delete(node.id);
154 };
155
156 return {
157 listFiles,

Callers

nothing calls this directly

Calls 2

normalizePathFunction · 0.90
findNodeByPathFunction · 0.85

Tested by

no test coverage detected