MCPcopy Create free account
hub / github.com/error311/FileRise / walkEntry

Function walkEntry

public/js/sharedDropView.js:656–684  ·  view source on GitHub ↗
(entry, prefix)

Source from the content-addressed store, hash-verified

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;

Callers 1

filesFromDropEventFunction · 0.85

Calls 1

readAllDirectoryEntriesFunction · 0.85

Tested by

no test coverage detected