Node, Angular, RecordRTC – saving uploaded video blob to disk

how to Node, Angular, RecordRTC – saving uploaded video blob to disk

I want to write an uploaded Video+Audio blob to disk on a node server.
The blob was generated by RecordRTC after recording the stream and I use Angular’s $http.post to send the video blob along with some other identifying data to the server as below

// localStreamRecorder is an instance of RecordRTC
self.localStreamRecorder.getDataURL(function(dataUrl) {
    var data = {
        call_id: 'USR009',
        media: dataUrl
    };
    $http.post('/api/recorded_call', data)
        .then(function(res) {
            console.log(res);
        }, function(err) {
            console.log(err);
        });
});

On the server side, I am able to access the blob but I am unable to write the blob as a valid video file using the code below.

app.route('/api/recorded_call')
    .post(function(req, res) {
        console.log(req.body);
        fs.writeFile('video-'+req.body.user_id, req.body.media,
            function(err) {
            if (err) {
                throw err;
            } else {
                res.send({ 'success': true });
            }
        });
    });

Is there anyway I can write the blob (media attribute of req.body) as a valid video file to disk for later access and viewing?

[EDIT]
I have included the log showing the output of req.body below (media attribute shortened)

{ call_id: '161f25090811617F62CD62',
  media: 'data:audio/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQRChYECGFOAZwH/////////FUmpZpkq17GDD0JATYCGQ2hyb21lV0GGQ2hyb21lFlSua7+uvdeBAXPFh5ekuYmhmlqDgQKGhkFfT1BVU2Oik09wdXNIZWFkAQEAAIC7AAAAAADhjbWERzuAAJ+BAWJkgRAfQ7Z1Af/////////ngQCjQh+
BAACA+4PfkcoFL7c9XEormBZ3dLyTnMQQn2YnFE9bYuzBo+L0kXK1ttvkEhn2s7fbuLJzIpRZ5Z2CZM8d5HJ4MNnupGB3DeRV/S9K86keLStaGDzpe4bl9+GcEF8RiyqQbl84TE3HLCJqusEf/voXH+IZ4wm3YT1oFY8ai0PZtdnLqwzdyqUDGCVZGFMqM4swwp5765bzjWL10e7TN6UTelJ2/1VbZ1/WvUzvo1bok7S+En7XuQcBJElINlZ
Lyx4hXAnMkV+9YkDfQ0tc2hen6VJVBBPG9mQOqFkqPrB02H6u825KRpewZSwtYYe4Q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