MCPcopy Index your code
hub / github.com/cameri/nostream / formatCompressionDelta

Function formatCompressionDelta

src/scripts/export-events.ts:52–66  ·  view source on GitHub ↗
(rawBytes: number, outputBytes: number)

Source from the content-addressed store, hash-verified

50}
51
52export const formatCompressionDelta = (rawBytes: number, outputBytes: number): string | undefined => {
53 if (rawBytes <= 0) {
54 return undefined
55 }
56
57 const deltaPercent = ((rawBytes - outputBytes) / rawBytes) * 100
58 const rounded = Math.round(Math.abs(deltaPercent) * 100) / 100
59 const formattedPercent = String(rounded)
60
61 if (deltaPercent >= 0) {
62 return `${formattedPercent}% smaller`
63 }
64
65 return `${formattedPercent}% larger`
66}
67
68export const getRatePerSecond = (value: number, elapsedMs: number): number => {
69 if (!Number.isFinite(value) || value <= 0) {

Callers 2

runExportEventsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected