blobToJson = (blobData) => {
return new Promise((resolve, reject) => {
const reader: any = new FileReader()
let jsonData: any
reader.readAsText(blobData, 'utf-8')
reader.onload = () => {
jsonData = JSON.parse(reader.result)
resolve(jsonData)
}
reader.onerror = () => {
reject(new Error('文件读取失败'))
}
})
}
标签:流转,jsonData,JSON,Blob,reader,new,any
From: https://www.cnblogs.com/luckyitape/p/17138201.html