小程序ArrayBuffer转JSON

1       let arrayBuffer = fsm.readFileSync(res.tempFilePath)
2       let unit8Arr = new Uint8Array(arrayBuffer)
3       let encodedString = String.fromCharCode.apply(null, unit8Arr)
4       let decodedString = decodeURIComponent(escape(encodedString))
5       console.log(JSON.parse(decodedString))

 

1 let arrayBuffer = fsm.readFileSync(tempFilePath,"utf-8")
2 console.log(JSON.parse(arrayBuffer))

 

posted @ 2020-12-16 11:59  letleon  阅读(1950)  评论(0编辑  收藏  举报