readAsDataURL

The readAsDataURL() method of the FileReader interface is used to read the contents of the specified file's data as a base64 encoded string.

MDN Reference