I searched all the last day an API to send Datas, from Javascript Client Side to the my NodeJS server with express, code below.
app.post('/microphone', express.raw({type: "*/*", limit: '1000000mb' }), function(req, res)
{
var buffer = req.body.buffer;
var nbrVoice = req.body.nbrVoice;
var codeUser = req.body.codeUser;
var dirUsers = "users/"+codeUser+"/";
fs.appendFileSync(( dirUsers +nbrVoice+ '_microphone.wav'), buffer );
res.send( "Okay wav file saved );
});
I have a server with expressjs and I want to send a DataView or a Blob with two number
[blob, codeUser, nbrVoice ]
I tried with xmlhttprequest, a modern version of that call fetch but that not worked and i am blocked with the raw binary data to string to buffer datas on the server.
if someone have an idea I search a code without jquery.