I am sending data from a NetSuite Suitelet to the Square Connect API. I am using SuiteScript 2.
I need to send an image file from the NetSuite file cabinet to Square via an HTTP POST. The data needs to be sent as binary data in a multipart form, according to the Square documentation at https://docs.connect.squareup.com/api/connect/v2#endpoint-v1items-uploaditemimage.
I think I've got the multipart form working, thanks to https://stackoverflow.com/a/46964827/127434.
However, I haven't worked out how to get the file data into a binary format that will be accepted by Square. Square complains: "Invalid multipart form data".
I will be happy to receive suggestions.