Home / Function/ formatBytesPrecision() — supabase Function Reference

formatBytesPrecision() — supabase Function Reference

Architecture documentation for the formatBytesPrecision() function in Usage.utils.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  f57e739b_91f0_28ed_a487_c0e0bc3f3715["formatBytesPrecision()"]
  f528da26_53cb_bb06_269c_12d2fbeec3f7["ChartTooltipValueFormatter()"]
  f528da26_53cb_bb06_269c_12d2fbeec3f7 -->|calls| f57e739b_91f0_28ed_a487_c0e0bc3f3715
  style f57e739b_91f0_28ed_a487_c0e0bc3f3715 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/interfaces/Organization/Usage/Usage.utils.ts lines 99–108

const formatBytesPrecision = (bytes: any) => {
  if (bytes === 0 || bytes === undefined) return '0 bytes'

  const k = 1024
  const i = Math.floor(Math.log(bytes) / Math.log(k))

  const unit = sizes[i]

  return parseFloat((bytes / Math.pow(k, i)).toFixed(3)) + ' ' + unit
}

Subdomains

Frequently Asked Questions

What does formatBytesPrecision() do?
formatBytesPrecision() is a function in the supabase codebase.
What calls formatBytesPrecision()?
formatBytesPrecision() is called by 1 function(s): ChartTooltipValueFormatter.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free