Uploading files to APIs like MailSlurp's typically involves sending a file as a base64 encoded string to a server as the text/plain body of an HTTP POST request. Converting a file to a base64 string means reading a file into a byte array and then encoding the byte array into a string using base64 encoding.
Here are different ways to convert a file to base64 in several common languages.
Node JS
To convert a file to Base64 string in Node:
Java
To convert a file to Base64 string in Java 8+:
Golang
To convert a file to Base64 string in Golang: