res.tempFilePath 临时路径
_doc/uniapp_temp_1721876002122/recorder/1721877299550.mp3
官方文档:https://www.html5plus.org/doc/zh_cn/io.html
plus.io.getAudioInfo({
filePath: res.tempFilePath,
success: ree => {
console.log('文件信息::', ree)
}
})
plus.io.resolveLocalFileSystemURL(res.tempFilePath, entry => {
entry.file(file => {
console.log("文件对象:", file)
const reader = new plus.io.FileReader()
reader.onload = function(evt) {
const fileData = evt.target.result
console.log("文件流数据:", fileData)
}
reader.onerror = function(err) {
console.error("读取文件流失败:", err.message)
}
reader.readAsText(file, 'UTF-8')
// reader.readAsDataURL(file, 'UTF-8')
})
}, err => {
console.error("获取文件失败:", err.message)
})