axios + multipart/formdata

pardon my stupidity, i'm coming from python :P how do i specify Content-Type and filename in Axios.js multipart formdata? python is like this:
url = 'http://httpbin.org/post'
data = aiohttp.FormData()
data.add_field('file',
open('report.xls', 'rb'),
filename='report.xls',
content_type='application/vnd.ms-excel')

await session.post(url, data=data)
url = 'http://httpbin.org/post'
data = aiohttp.FormData()
data.add_field('file',
open('report.xls', 'rb'),
filename='report.xls',
content_type='application/vnd.ms-excel')

await session.post(url, data=data)
which would produce something like
Content-Disposition: form-data; name="file"; filename="report.xls"
Content-Type: application/vnd.ms-excel

[binary data]
Content-Disposition: form-data; name="file"; filename="report.xls"
Content-Type: application/vnd.ms-excel

[binary data]
i just don't know how to specify it in Axios.js since there is no documentation for it: https://axios-http.com/docs/multipart [just has field name and blob data]
Solution:
nevermind i need to use
const FormData = require("form-data")
const form = new FormData();
form.append("file", fs.createFileStream("path/to/file"));
const FormData = require("form-data")
const form = new FormData();
form.append("file", fs.createFileStream("path/to/file"));
...
Jump to solution
1 Reply
Solution
PRIZ ;]
PRIZ ;]8mo ago
nevermind i need to use
const FormData = require("form-data")
const form = new FormData();
form.append("file", fs.createFileStream("path/to/file"));
const FormData = require("form-data")
const form = new FormData();
form.append("file", fs.createFileStream("path/to/file"));
Want results from more Discord servers?
Add your server