(item: any, path?: string)
| 64 | |
| 65 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 66 | const traverseFileTree = async (item: any, path?: string) => { |
| 67 | if (processedCount >= MAX_FILES) return; |
| 68 | path = path || ''; |
| 69 | |
| 70 | if (item.isFile) { |
| 71 | processedCount++; |
| 72 | return new Promise<void>(resolve => { |
| 73 | item.file((file: File) => { |
| 74 | if (isValidFile(file)) files.push(file); |
| 75 | resolve(); |
| 76 | }); |
| 77 | }); |
| 78 | } else if (item.isDirectory) { |
| 79 | const dirReader = item.createReader(); |
| 80 | return new Promise<void>(resolve => { |
| 81 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 82 | dirReader.readEntries(async (entries: any[]) => { |
| 83 | for (const entry of entries) { |
| 84 | await traverseFileTree(entry, path + item.name + '/'); |
| 85 | } |
| 86 | resolve(); |
| 87 | }); |
| 88 | }); |
| 89 | } |
| 90 | }; |
| 91 | |
| 92 | const items = e.dataTransfer.items; |
| 93 | const promises = []; |
no test coverage detected