I am struggeling very hard with a Javascript under Node-js, which should read a file from disk and post it via a post-request to DeepStack Facial Recognition system to do something with it.
I currently always receive a 400 Code –> “No valid image file found”
I think it might have to do with the file not beeing transported via Axios as the post-payload.
The following code I am using:
var image_stream = fs.createReadStream('./somefile.jpg')
var form = new FormData()
form.append('image', image_stream);
axios({
method: "post",
url: "http://192.168.178.46:666/v1/vision/face/recognize",
headers: { 'Content-Type': 'multipart/form-data'},
data: form,
timeout: 1000
}).then(function (response) {
// do some stuff with the response
}).catch(function(error){log(error)})
Neither createReadStream
nor ReadFileSync
is working here and also everything I have tried with the header and the form-data was not working.
I also tried fetch
and other packages to send the data, but no luck.
Can you help me here with advice?
KR
SEB