title: How do you add a header to wav file?
body: <p>I am sending audio data stored as a blob to my backend (node/express). When I save the file as .wav and attempt to use in the SpeechRecogition package in python it throws an error saying the "file does not start with RIFF id".  So how can I add the headers to my blob file before I save it so that it is a correctly formatted .wav file? I can provide the code if necessary.</p>
  
  <p>node.js file</p>
  
  <pre><code>var multer = require('multer');
  var fs = require('fs'); //use the file system so we can save files
  var uniqid = require('uniqid');
  var spawn = require('child_process').spawn;
  const storage = multer.memoryStorage()
  var upload = multer({ storage: storage });
  
  router.post('/api/test', upload.single('upl'), function (req, res) {
  
     console.log(req.file);
     console.log(req.file.buffer);
  
     var id = uniqid();
     fs.writeFileSync(id+".wav", Buffer.from(new Uint8Array(req.file.buffer))); //write file to server as .wav file
  
     const scriptPath = 'handleAudio.py'
     const process = spawn('python3', [__dirname+"/../"+scriptPath, "/home/bitnami/projects/sample/"+id+".wav", req.file.originalname, 'True']); //throws error about header in .wav
  
  });
  </code></pre>
  
  <p>Also I had this same example working with a php endpoint that just saved the blob to a file with .wav extension and the python file accepted it. What could be different in the <code>move_uploaded_file</code> in php and what I am doing above with node? </p>