MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / FileTree

Function FileTree

webUi/scripts.js:443–463  ·  view source on GitHub ↗
(item, path = "", filesQ)

Source from the content-addressed store, hash-verified

441 handleFileForm(filesQ, _("actualFolder").value);
442}
443function FileTree(item, path = "", filesQ) {
444 return new Promise((resolve) => {
445 if (item.isFile) {
446 item.file(function (file) {
447 const fileWithPath = new File([file], path + file.name, { type: file.type });
448 filesQ.push(fileWithPath);
449 resolve();
450 });
451 } else if (item.isDirectory) {
452 const dirReader = item.createReader();
453 dirReader.readEntries((entries) => {
454 const entryPromises = [];
455 for (let i = 0; i < entries.length; i++) {
456 entryPromises.push(FileTree(entries[i], path + item.name + "/", filesQ));
457 } Promise.all(entryPromises).then(resolve);
458 });
459 } else {
460 resolve();
461 }
462 });
463}
464window.addEventListener("load", () => {
465 listFilesButton("/");
466 systemInfo();

Callers 1

dropFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected