将Blob保存为PNG文件

问题描述

我目前正在使用以下几行来获取和保存png数据。

var arrayToTree = require('array-to-tree');

var array = [
  {
     name: "0.Mzondo",id: "nW4j6JDVFGn",parent: {
       id: "ppx2evdioFG"
     }
 },{
   name: "1 Chipho",id: "eE4p4gXpR4p",parent: {
     id: "JKNTgsOVMOo"
   }
 },{},....
  
} 

array.map((item) => {
                    //

                    if(item.parent != null){
                        //console.log(item.parent.id)
                        item.parent = item.parent.id
                    } else {
                        item.parent = undefined
                    }
                });

                var tree = arrayToTree(array,{
                    parentProperty: 'parent',customID: 'id'
                });

                console.log( tree );

                this.setState({
                    orgUnits : tree
                });

当我尝试打开文件时,它显示“读取PNG图像文件时发生致命错误:不是PNG文件”。

我在做什么错了?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)