How to convert binary object to multipart/form-data inside mongoDB Realm Cloud

Hello Friends,
I am working on a function within MongoDB Realm Cloud and need to send a pdf file to an address in multipart/form-data format. I already got the binary object by reading the post Can i send form data
But I am not finding a method to pass this object to the multipart/form-data format.
Does anyone know how to do this inside a MongoDB Realm Cloud function?