I have a image saved in a buffer I would like to upload to a webserver without need to saved it to disk. I am using Axios as the lib for handling the post request
My code for posting is as follows
const payload = new FormData();
payload.append('file', buffer, { filename: 'unknown.png', contentType: 'image/png', knownLength: buffer.toString().length });
const token = await RetreiveToken();
const resp = await Axios.post(`https://api.novastudios.tk/${endpoint}`, payload, {
headers: {
...payload.getHeaders(),
'Authorization': token
},
maxBodyLength: 20971520,
maxContentLength: 20971520,
});
The response from the server is a 500, upon having the web server log the incoming file I found that no file data was being sent (But the server was receiving a proper length header). I have tried converting the buffer to a Readable, and a Duplex but again nothing. I also added the filename, contentType and length parts but nothing either. Using electron + node.js for client and asp.net api for server)