i got corrupted files when i send it to and api

i did al the proces to get the buffer from the file afyer that i encode that buffer in a binary format but when the 3rd api recived the files and opend it in other enviorment the file doesnt have content the pdf files are just a white paper for example without images or text also the jpg files doesnt allow me to opend it it say its corrupted


entradapfiles3 its just the function with the api i send it the name of the file and the value of the file in binary

i have to add that in the screenshot joda=encode its reurnin in base64 but its just for testing purposes because if i put the encode in binary its just give the same results of corrypted files or blank pdfs