I can open the file in binary mode with Python and store it in a variable.
I have been researching this for two days, and I can’t seem to find a straightforward answer. I need this because I have been working on a project that we have completed in Python, but we need to convert it into JavaScript. The issue that I’m having is that I need to send a file through an API call. Still, every time I do, I get this error ‘ HTTP 415 Unsupported Media TypeThe provided media type is not supported for the requested URI. What I have is a JSON file that I need to pass to a post-call in binary
files = {'file': open(JSON_File, 'rb')}
response = requests.post(
URL,
auth=(USERNAME, PASSWORD),
files=files
#files=files, verify = False
)
response.text
how can I do this in nodeJS? I completed the above already in Python.