(url: string)
| 1 | export 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 | } |
no test coverage detected