What would be the HTTP equivalent of this cURL request? I've tried to translate and haven't been able to pass the file correctly to the API.
$ curl -F "file=@test.txt" https://xxxxxx
I've tried:
const formData = {
file: 'pathToFile'
}
request
.post({
url: 'xxxxxx',
form: formData
})
.on('response', (response) => {
console.log(response);
});
which gives me a 5xx server error ~ file param undefined.
how would I go about doing this in Node.js? I'm using Request