Code Snippet
const form = new FormData()
form.append(
'file_image',
img_buffer,
{
filename: `${crypto.randomUUID()}.jpg`,
contentType: 'image/jpg',
knownLength: img_buffer.length
}
)
form.append(
'file_json',
JSON.stringify(data),
{
filename: `${crypto.randomUUID()}.json`,
contentType: 'multipart/form-data',
knownLength: JSON.stringify(data).length
}
)
const options = {
responseType: 'arraybuffer',
headers: {
...form.getHeaders(),
'Content-Type': 'image/jpg'
},
maxContentLength: Infinity,
maxBodyLength: Infinity
}
axios.post(url, form, options)