export function blobToBase64 ( data ) { return new Promise < string > ( ( resolve , reject ) => { const fileReader = new FileReader ( ) ; fileReader . readAsDataURL ( data ) ; fileReader . onloadend = ( evt ) => resolve ( String ( fileReader . result ) ) ; fileReader . onerror = ( evt ) => reject ( null ) ; } ) ; }