I've got 2 .wav files that I'd like to join, however for some reason I can only get my output file to contain the first item in the array:
const writeStream = fs.createWriteStream('server/playback.wav'); const inputFiles = [ `${path.resolve(__dirname, 'response.wav')}`, `${path.resolve(__dirname, 'broadcast.wav')}` ]; joinAudio() { if(!inputFiles.length) { console.log("done") writeStream.end("Done"); return } currentFile = inputFiles.shift() let stream = fs.createReadStream(currentFile); stream.pipe(writeStream, {end: false}); stream.on('end', () => { console.log(currentFile, "appended") self.joinAudio() }); } My code logs out both files have been appended, and done, but I can't understand why only 1 file is included.
Both files I am trying to join are here:
broadcast.wav - https://ufile.io/mlnkt
response.wav - https://ufile.io/ta937