MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / formatBytesShort

Function formatBytesShort

console/src/utils/format.ts:55–61  ·  view source on GitHub ↗
(bytes: bigint)

Source from the content-addressed store, hash-verified

53}
54
55export const formatBytesShort = (bytes: bigint) => {
56 const { value, unit } = humanizeBytes(bytes);
57 const numberFormatter = Intl.NumberFormat("default", {
58 maximumFractionDigits: value % 1 === 0 ? 0 : 2,
59 });
60 return `${numberFormatter.format(value)} ${unit}`;
61};
62
63export function convertBytes(bytes: number, unit: ByteUnit) {
64 switch (unit) {

Callers 5

ClusterMetricsInnerFunction · 0.90
QueryHistoryDetailsCardFunction · 0.90
scopeToGvFunction · 0.90

Calls 2

humanizeBytesFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected