如何将Blob对象合并为.log()?

2022-08-04 00:00:00 blob javascript console.log

我有一个要通过记录其值来检查的Blob对象。我只能看到typesize属性。有办法做到这一点吗?


解决方案

使用FileReader查看Blob中的内容的基本示例

var html= ['<a id="anchor">Hello World</a>'];
var myBlob = new Blob(html, { type: 'text/xml'});
var myReader = new FileReader();
myReader.onload = function(event){
    console.log(JSON.stringify(myReader.result));
};
myReader.readAsText(myBlob);

相关文章