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

Function downloadSelectedFilesIndividually

public/js/fileListView.js:8532–8564  ·  view source on GitHub ↗
(fileObjs)

Source from the content-addressed store, hash-verified

8530 * (e.g. currentSelection().files in fileMenu.js).
8531 */
8532export function downloadSelectedFilesIndividually(fileObjs) {
8533 const src = Array.isArray(fileObjs) ? fileObjs : [];
8534
8535 if (!src.length) {
8536 showToast(t('no_files_selected') || 'No files selected.', 'warning');
8537 return;
8538 }
8539
8540 const mapped = src.map(f => ({
8541 folder: f.folder || window.currentFolder || 'root',
8542 name: f.name,
8543 sourceId: String(f.sourceId || getActivePaneSourceId() || '').trim()
8544 }));
8545
8546 const limit = window.maxNonZipDownloads || MAX_NONZIP_MULTI_DOWNLOAD;
8547 if (mapped.length > limit) {
8548 const inEncrypted = !!(window.currentFolderCaps && window.currentFolderCaps.encryption && window.currentFolderCaps.encryption.encrypted);
8549 const msg = inEncrypted
8550 ? `You selected ${mapped.length} files. In encrypted folders, downloads are limited to ${limit} files at a time.`
8551 : (t('too_many_plain_downloads', { count: mapped.length, limit }) || `You selected ${mapped.length} files. For more than ${limit} files, please use "Download as Archive".`);
8552 showToast(msg, 'warning');
8553 return;
8554 }
8555
8556 // Replace any existing queue with the new one.
8557 window.__nonZipDownloadQueue = mapped.slice();
8558
8559 // Show the panel; user will click "Download next" for each file.
8560 showNonZipPanel();
8561
8562 // auto-fire the first file here:
8563 triggerNextNonZipDownload();
8564}
8565
8566function compareFilesForSort(a, b) {
8567 const column = sortOrder?.column || "uploaded";

Callers 3

menuClickDelegateFunction · 0.85

Calls 5

tFunction · 0.85
showNonZipPanelFunction · 0.85
showToastFunction · 0.70
getActivePaneSourceIdFunction · 0.70

Tested by

no test coverage detected