2

I'm not sure how to create a blob from a wav file in node. Do I just use Buffer like so?...

var blippityBlob = new Buffer(filePathToWave);
RadleyMith
  • 1,313
  • 11
  • 22

2 Answers2

1

Maybe you could take a look at BinaryJS

Quoting:

BinaryJS is a lightweight framework that utilizes websockets to send, stream, and pipe binary data bidirectionally between browser javascript and Node.js.

Server Code

    var server = BinaryServer({port: 9000});
    server.on('connection', function(client){
       client.on('stream', function(stream, meta){
           var file = fs.createWriteStream(meta.file);
           stream.pipe(file);
  }); 
});

Client Code

    var client = BinaryClient('ws://localhost:9000');
    client.on('open', function(stream){
       var stream = client.createStream({file: 'hello.txt'});
       stream.write('Hello');
       stream.write('World!');
       stream.end();
});
Basit Anwer
  • 6,742
  • 7
  • 45
  • 88
0

The answer lies in a combination of these two posts:

Node.js can´t create Blobs?

Convert a binary NodeJS Buffer to JavaScript ArrayBuffer

Community
  • 1
  • 1
RadleyMith
  • 1,313
  • 11
  • 22