Currently I have two node.js servers connected (server1 & server2). I'm trying to get an audio file (.wav) that is saved on server1 to server2 and save it as a file on server2. I have it setup right now using mediaserver.
On server1...
ms = require('mediaserver');
app.get(/audio, function(req, res){
ms.pipe(req, res, "/example.wav");
});
This works when I try to receive it with a standard html file using
<audio controls>
<source src="/audio" type="audio/wav">
Your browser does not support the audio element.
</audio>
How would I receive it and save it on server2, though. I've tried without success to write it like it was a binary file using
axios
.get('/audio', {})
.then(res => {
fs.writeFile('received.wav', res.data, function(err) {
// etc
});
})
Also, it may be of note that it is a 2 channel audio file with a rate of 16000.