MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / scanDirectoryHandle

Function scanDirectoryHandle

src/utils/fileScanning.ts:63–81  ·  view source on GitHub ↗
(
  dirHandle: FileSystemDirectoryHandle,
  path: string,
  files: Map<string, File>
)

Source from the content-addressed store, hash-verified

61 * Recursively scan File System Access API directory handles from showDirectoryPicker().
62 */
63export async function scanDirectoryHandle(
64 dirHandle: FileSystemDirectoryHandle,
65 path: string,
66 files: Map<string, File>
67): Promise<void> {
68 try {
69 for await (const entry of dirHandle.values()) {
70 const fullPath = path ? `${path}/${entry.name}` : entry.name;
71 if (isFileSystemFileHandle(entry)) {
72 const file = await entry.getFile();
73 files.set(fullPath, file);
74 } else if (isFileSystemDirectoryHandle(entry)) {
75 await scanDirectoryHandle(entry, fullPath, files);
76 }
77 }
78 } catch (err) {
79 appLogger.warn(`Failed to scan directory: ${path}`, err);
80 }
81}

Callers 1

Calls 4

isFileSystemFileHandleFunction · 0.85
valuesMethod · 0.65
getFileMethod · 0.65

Tested by

no test coverage detected