How to send png file as binary data to node.js server from react?
21:41 01 Jul 2022

I am working with an api that requires me to send png files as binary data to my backend. In their docs they show how to do this with a curl example ( I have never used curl ) but they dont show how to do this with axios to a node.js server ( despite examples of node.js on everything else).

How would I convert this following example of a curl to post request to a node.js server? I am using axios and react for the front end and Node.js for backend.

Here is the curl example, How would I do this in axios?

Also, How do I convert a .png file to binary data in React before sending post request with axios?

curl -u ":" --data-binary @ -H "Content-Type: " https://mcs.us1.twilio.com/v1/Services//Media

node.js reactjs axios twilio