js 将 blob 转 arrayBuffer 、 arrayBuffer 转 Uint8Array 、 Uint8Array 转 String 的方法
1. blob 转 arrayBuffer
blobToArrayBuffer(blob, callback) { let reader = new FileReader(); reader.onload = function() { return callback(this.result); } reader.readAsArrayBuffer(blob); }
2. arrayBuffer 转 Uint8Array
var u8a = new Uint8Array(arrayBuffer);
3.Uint8Array 转 String
uint8ArrayToString(u8a) { var dataStr = ""; for(var i=0;i