(entry, prefix)
| 654 | } |
| 655 | |
| 656 | async function walkEntry(entry, prefix) { |
| 657 | if (!entry) return []; |
| 658 | |
| 659 | if (entry.isFile) { |
| 660 | return new Promise((resolve) => { |
| 661 | entry.file(function (file) { |
| 662 | const rel = prefix ? (prefix + file.name) : file.name; |
| 663 | resolve([{ file, relativePath: rel }]); |
| 664 | }, function () { |
| 665 | resolve([]); |
| 666 | }); |
| 667 | }); |
| 668 | } |
| 669 | |
| 670 | if (!entry.isDirectory) { |
| 671 | return []; |
| 672 | } |
| 673 | |
| 674 | const reader = entry.createReader(); |
| 675 | const children = await readAllDirectoryEntries(reader); |
| 676 | let out = []; |
| 677 | for (let i = 0; i < children.length; i++) { |
| 678 | const child = children[i]; |
| 679 | const childPrefix = prefix + entry.name + '/'; |
| 680 | const nested = await walkEntry(child, childPrefix); |
| 681 | out = out.concat(nested); |
| 682 | } |
| 683 | return out; |
| 684 | } |
| 685 | |
| 686 | async function filesFromDropEvent(e) { |
| 687 | const dt = e.dataTransfer; |
no test coverage detected