Function convertBlobToBase64

  • Converts a Blob object into a Base64-encoded string.

    Returns

    A Promise that resolves to the Base64 string representation of the blob.

    Example

    const blob = new Blob(['Hello, world!'], { type: 'text/plain' });
    const base64 = await convertBlobToBase64(blob);
    console.log(base64); // → 'SGVsbG8sIHdvcmxkIQ=='

    Remarks

    • Internally uses FileReader.readAsDataURL to serialize the blob.
    • The returned Base64 string excludes the data URL prefix (e.g., data:text/plain;base64,).
    • The promise is rejected if the blob cannot be read.

    Parameters

    • blob: Blob

      The Blob to convert.

    Returns Promise<string>

Generated using TypeDoc