MCPcopy Create free account
hub / github.com/vercel/vercel / format_bytes

Function format_bytes

packages/python-analysis/scripts/profile-wasm.py:97–103  ·  view source on GitHub ↗

Human-readable byte size.

(n)

Source from the content-addressed store, hash-verified

95
96
97def format_bytes(n):
98 """Human-readable byte size."""
99 if n >= 1_048_576:
100 return f"{n / 1_048_576:.2f} MB"
101 if n >= 1024:
102 return f"{n / 1024:.1f} KB"
103 return f"{n} B"
104
105
106def format_bytes_long(n):

Callers 5

format_bytes_longFunction · 0.85
render_overviewFunction · 0.85
render_crate_tableFunction · 0.85
render_items_tableFunction · 0.85
render_flamegraph_linksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected