Unfortunately, it is not possible to copy the code of the base component.
I have created a small sample custom component for you that converts the selected file to base64. Based on it you will be able to implement the functionality you need.
I also recommend you check out my colleague’s excellent guide to creating custom components:
You will need to create a file, I think this solution will work for you:
Regards, Alexander