I am working with node.js and I streamed my Audio to my node.js server. Now I noticed during the process of building the audio blob:
var audioBlob = new Blob([dataview], { type: 'audio/wav' });
That I get a ReferenceError at new Blob. It seems that Blob is not supported. How can I create a blob which I would like to save with node.js fs module.
Thanks guys!
The Solution to this problem is to create a function which can convert between Array Buffers and Node Buffers. :)
As a suggestion, you might want to read this: http://howtonode.org/really-simple-file-uploads
I mean I guess I don't know what you're trying to do. There may not be a module for blobs, but if you want to just write something to disk, there's the fs module.. This code won't work directly, but..
var fs = require('fs')
, express = require('express')
app.post('/upload', function (req, res) {
// asynch call to write file to disk
fs.write("/tmp/file.mp3", req.params.body, function (err) {
if (err) console.log(err)
});
res.end();
});
Simply post an mp3, or anything really, to /upload, and it'll write it to disk. You can do whatever validation you want.