In Pega we use Base64Utils class to convert the data into the bytearray with the help of encode and decode methods in it. You can look into the Base64Utils class methods and use the appropriate one. For further information kindly refer SendEmailMessage function where the email attachments are converted into the bytearray which is used in the pyInvokeRestConnector.
The upload button that is used to upload an attachment from the client's system itself will convert the file into a binary format. Please check the dragdrop page in the clipboard in the same thread once you perform an upload of any file using the traditional upload button.
Assuming that the attachments received with the email are base64 encoded (This is the default pega behaviour), You could use OOTB functions / API available in PRPC to base64 decode to binary content. This binary content would be a stream of bytes that you can pass to your API .