blobToBase64()
Reads a Blob as a data URL string (data:<mime>;base64,...) using FileReader#readAsDataURL.
Useful for previewing uploads, embedding small assets inline, or serializing binary for APIs that expect Base64-in-JSON. The result includes the MIME prefix, not raw Base64 alone — use decodeDataUrl if you need the payload and type separately.
Examples:
ts
const dataUrl = await blobToBase64(file);
previewImg.src = dataUrl;ts
const fromFetch = await fetch('/api/export').then((r) => r.blob());
const dataUrl = await blobToBase64(fromFetch);