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

Function formatBytes

public/js/folderManager.js:2996–3005  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

2994}
2995
2996function formatBytes(n) {
2997 const num = Number(n || 0);
2998 if (!Number.isFinite(num) || num <= 0) return '0 B';
2999 const units = ['B', 'KB', 'MB', 'GB', 'TB'];
3000 let v = num;
3001 let i = 0;
3002 while (v >= 1024 && i < units.length - 1) { v /= 1024; i++; }
3003 const dp = (i === 0) ? 0 : (i === 1 ? 0 : 1);
3004 return `${v.toFixed(dp)} ${units[i]}`;
3005}
3006
3007function formatDuration(ms) {
3008 const total = Math.max(0, Math.floor(Number(ms || 0) / 1000));

Callers 1

startFolderCryptoJobFlowFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected