在Firefox / Chrome中,有没有一个函数可以从Blob的切片中重组Blob?也就是说,执行与slice()操作相反的操作?
提亚
发布于 2013-06-17 02:32:44
构造函数本身就可以做到这一点
var b1 = new Blob(['abcdef']), // Inital Blob
b2, // re-created Blob to go here
s1 = b1.slice(0, 3), // a slice
s2 = b1.slice(3, 6); // another slice
// now reverse the slicing
b2 = new Blob([s1, s2]);
b2.size; // 6如果你真的想仔细检查
var f = new FileReader();
f.onload = function () {console.log(this.result);};
f.readAsText(b1); // "abcdef"
f.readAsText(b2); // "abcdef"
// and the slices
f.readAsText(s1); // "abc"
f.readAsText(s2); // "def"https://stackoverflow.com/questions/17135726
复制相似问题