how to send b64 image as uri in typescript

index.ts
// Convert an image to base64
const imageFile = ...; // Get your image file
const reader = new FileReader();
reader.onloadend = function () {
    const base64Image = reader.result;
    
    // Send the base64 image as a data URI
    const uri = "data:image/png;base64," + base64Image;
    
    // Now you can use this URI to display the image or send it to a server
};
reader.readAsDataURL(imageFile);
402 chars
13 lines

related categories

gistlibby LogSnag