(path = '/')
| 44 | }; |
| 45 | |
| 46 | const listFiles = async (path = '/'): Promise<FileNode[]> => { |
| 47 | const normalizedPath = normalizePath(path); |
| 48 | const parentNode = findNodeByPath(normalizedPath); |
| 49 | |
| 50 | if (!parentNode) { |
| 51 | return []; |
| 52 | } |
| 53 | |
| 54 | if (parentNode.type !== 'folder') { |
| 55 | return [parentNode]; |
| 56 | } |
| 57 | |
| 58 | const children: FileNode[] = []; |
| 59 | for (const childId of parentNode.children || []) { |
| 60 | const child = store.get(childId); |
| 61 | if (child) { |
| 62 | children.push(child); |
| 63 | } |
| 64 | } |
| 65 | return children; |
| 66 | }; |
| 67 | |
| 68 | const readFile = async (path: string): Promise<ReadFileResult> => { |
| 69 | const normalizedPath = normalizePath(path); |
nothing calls this directly
no test coverage detected