MCPcopy Create free account
hub / github.com/firebase/firebase-tools / formatBytes

Function formatBytes

src/profileReport.ts:54–67  ·  view source on GitHub ↗
(bytes: number)

Source from the content-addressed store, hash-verified

52}
53
54export function formatBytes(bytes: number) {
55 const threshold = 1000;
56 if (Math.round(bytes) < threshold) {
57 return bytes + " B";
58 }
59 const units = ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
60 let u = -1;
61 let formattedBytes = bytes;
62 do {
63 formattedBytes /= threshold;
64 u++;
65 } while (Math.abs(formattedBytes) >= threshold && u < units.length - 1);
66 return formatNumber(formattedBytes) + " " + units[u];
67}
68
69export function extractReadableIndex(query: Record<string, any>): string {
70 if (query.orderBy) {

Callers 1

renderBandwidthMethod · 0.85

Calls 1

formatNumberFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…