MCPcopy Create free account
hub / github.com/anomalyco/opencode / base64Size

Function base64Size

packages/opencode/src/session/tools.ts:571–575  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

569}
570
571function base64Size(value: string) {
572 const trimmed = value.replace(/\s/g, "")
573 const padding = trimmed.endsWith("==") ? 2 : trimmed.endsWith("=") ? 1 : 0
574 return Math.max(0, Math.floor((trimmed.length * 3) / 4) - padding)
575}
576
577function formatBytes(value: number) {
578 if (value < 1024) return `${value} B`

Callers 2

tools.tsFile · 0.85
formatMcpResourceContentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected