Send blob data to node using fetch, multer, express
<p>Trying to send a blob object to my node server. On the client side I'm recording some audio using MediaRecorder and then I want to send the file to my server for processing.</p>

<pre><code>      saveButton.onclick = function(e, audio) {
        var blobData = localStorage.getItem('recording');
        console.log(blobData);

        var fd = new FormData();
        fd.append('upl', blobData, 'blobby.raw');

        fetch('/api/test',
          {
            method: 'post',
            body: fd
          })
        .then(function(response) {
          console.log('done');
          return response;
        })
        .catch(function(err){ 
          console.log(err);
        });

      }
</code></pre>

<p>This is my express route, which uses multer:</p>

<pre><code>  var upload = multer({ dest: __dirname + '/../public/uploads/' });
  var type = upload.single('upl');
  app.post('/api/test', type, function (req, res) {
    console.log(req.body);
    console.log(req.file);
    // do stuff with file
  });
</code></pre>

<p>But my logs return nothing:</p>

<pre><code>{ upl: '' }
undefined
</code></pre>

<p>Been spending a long time on this so any help appreciated!</p>