MCPcopy Create free account
hub / github.com/BruceDevices/firmware / appendDroppedFiles

Function appendDroppedFiles

embedded_resources/web_interface/index.js:216–237  ·  view source on GitHub ↗
(entry)

Source from the content-addressed store, hash-verified

214 }
215}
216async function appendDroppedFiles(entry) {
217 return new Promise((resolve, reject) => {
218 if (entry.isFile) {
219 entry.file((file) => {
220 let fileWithPath = new File([file], entry.fullPath.substring(1), {
221 type: file.type,
222 });
223 appendFileToQueue([fileWithPath]);
224 _queueUpload.push(fileWithPath);
225 resolve();
226 });
227 } else if (entry.isDirectory) {
228 let proms = [];
229 let reader = entry.createReader();
230 reader.readEntries((entries) => {
231 for (let e of entries) proms.push(appendDroppedFiles(e));
232 });
233
234 Promise.all(proms).then(resolve);
235 }
236 });
237}
238async function uploadFile() {
239 if (_queueUpload.length === 0) {
240 _runningUpload = false;

Callers 1

index.jsFile · 0.85

Calls 1

appendFileToQueueFunction · 0.85

Tested by

no test coverage detected