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

Function formatSize

public/js/fileListView.js:4656–4668  ·  view source on GitHub ↗

* Format the total bytes as a human-readable string.

(totalBytes)

Source from the content-addressed store, hash-verified

4654 * Format the total bytes as a human-readable string.
4655 */
4656function formatSize(totalBytes) {
4657 if (!Number.isFinite(totalBytes) || totalBytes < 0) return "";
4658
4659 if (totalBytes < 1024) {
4660 return totalBytes + " B";
4661 } else if (totalBytes < 1024 * 1024) {
4662 return (totalBytes / 1024).toFixed(1) + " KB";
4663 } else if (totalBytes < 1024 * 1024 * 1024) {
4664 return (totalBytes / (1024 * 1024)).toFixed(1) + " MB";
4665 } else {
4666 return (totalBytes / (1024 * 1024 * 1024)).toFixed(1) + " GB";
4667 }
4668}
4669
4670
4671function ensureNonZipDownloadPanel() {

Callers 5

fillHoverPreviewForRowFunction · 0.85
buildFolderSummaryHTMLFunction · 0.85
loadFileListFunction · 0.85
injectInlineFolderRowsFunction · 0.85
renderGalleryViewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected