How to Upload file via api by nodejs (express)

My service create by express.and use multer lib for receiving file from clients.
this’s a example of receiving file.

file:
{ fieldname: ‘file’,
originalname: ‘tmp:Screen Shot 2562-08-05 at 12.36.39.png’,
encoding: ‘7bit’,
mimetype: ‘image/png’,
buffer:
<Buffer 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 02 d5 00 00 01 4d 08 06 00 00 00 cf 6e 93 d8 00 00 0a ab 69 43 43 50 49 43 43 20 50 72 6f 66 69 … >,
size: 91997 }

My question is how to upload that file object to xibo via api through backend.
** in xibo api doc announce upload file with type (file).
thank you.

Now, I found the solution of this problem. *I use axios with form-data library.

const axios = require(“axios”);
const FormData = require(“form-data”);

const bodyData = new FormData();
bodyData.append(“files”, filebuffer, {
filename: name,
contentType: mimetype,
knownLength: size
});
bodyData.append(“name”, name);

/*** you have to config maxContentLength and maxBodyLength for uploading file
For uploading files larger than 2 mb */

let config = {
headers: bodyData.getHeaders(),
maxContentLength: Infinity,
maxBodyLength: Infinity
};

var result = await axios.post(url, bodyData, config);