MCPcopy Index your code
hub / github.com/anomalyco/opencode / decodeDataUrl

Function decodeDataUrl

packages/opencode/src/util/data-url.ts:1–9  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

1export function decodeDataUrl(url: string) {
2 const idx = url.indexOf(",")
3 if (idx === -1) return ""
4
5 const head = url.slice(0, idx)
6 const body = url.slice(idx + 1)
7 if (head.includes(";base64")) return Buffer.from(body, "base64").toString("utf8")
8 return decodeURIComponent(body)
9}

Callers 2

data-url.test.tsFile · 0.90
prompt.tsFile · 0.90

Calls 1

fromMethod · 0.45

Tested by

no test coverage detected