INNER CODE UNIT · Python
human_size
Far-Se/tabame · plugins/api-client/main.py:190
def human_size(n):
if n is None:
return "–"
if n < 1024:
return f"{n} B"
if n < 1024 * 1024:
return f"{n / 1024:.1f} KB"
return f"{n / 1024 / 1024:.1f} MB"
def short_url(url, limit=60):
u = url or ""
return u if len(u) <= limit else u[: limit - 1] + "…"
def format_body_markdown(result):
body = result.get("body", "")
if not body: