📅  最后修改于: 2022-03-11 15:01:26.807000             🧑  作者: Mango
async function fileToJSON(file) {
return new Promise((resolve, reject) => {
const fileReader = new FileReader()
fileReader.onload = event => resolve(JSON.parse(event.target.result))
fileReader.onerror = error => reject(error)
fileReader.readAsText(file)
})
}