File upload in b64

I’m working on a project, in which I take supporting documents(.jpg,.png,.pdf) along with other details.
I want to change the File into B64 before sending it to server. How can I do that? I’m not even able to use multiple MIME in <ion-input>. Need help? thanks in advance.

For example, if you select a jpeg (imageData) with Camera plugin:

const base64Image = 'data:image/jpeg;base64,' + imageData;

But you talk about all kind of files so you will need FileChooser. Example code can be like that:

this.file.readAsDataURL(filePath,fileName).then(base64=>{
 // Stuff
}

It’s giving error

FileError {code: "Class not found", message: undefined}