node.js - Nodejs 中的 Wav 到 Blob

标签 node.js websocket buffer blob

我不确定如何从 Node 中的 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 - Nodejs 中的 Wav 到 Blob,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31988884/

相关文章:

c# - 从 C# 中的缓冲区中检索多个对象

javascript - 如何在 documentdb 中编写查询以匹配精确的数组?

javascript - 客户端 Socket.io 持续断开并重新连接到 websocket

javascript - 使用 node.JS 和 Socket.IO 的路径和其他问题

websocket - Dart 的 websocket pingInterval 实际是如何使用的?

go - 有什么方法可以检查值是否缓冲在 Go chan 中?

node.js - 使用 Serverless 访问 SSM 变量

node.js - 在 Express.js 中使用相同的响应对象发送多个响应(res.json)

javascript - 我怎样才能故意让我的 node.js 服务器崩溃?

python - 如何将 python 中的 stdout 指针移动到上一行?