Wav 到 Node.js 中的 Blob

Wav to Blob in nodejs

我不确定如何从节点中的 wav 文件创建 blob。我就这么用Buffer吗?...

var blippityBlob = new Buffer(filePathToWave);

也许你可以看看BinaryJS

引用:

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

服务器代码

    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);
  }); 
});

客户代码

    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();
});

答案在于这两个帖子的组合:

Node.js can´t create Blobs?

Convert a binary NodeJS Buffer to JavaScript ArrayBuffer