react-native - 我如何在本机反应时读取文件?
问题描述
我想像这样在 react-native 读取文件 mp3 文件,我该怎么做。
<Buffer 75 64 e5 be 9b 6d e4 84 97 a3 10 61 50 07 13 72 b9 ca 95 56 a0 42 4b e7 23 ea 6a 09 cb 9c 4c 3f ac 9f 70 b8 f8 56 89 d8 2e 09 79 60 42 04 d0 91 22 dd ... 52499 more bytes>
解决方案
如果文件很大,您可以在从文件读取时定义您的类型,如果文件很大,您应该考虑使用readStream
。
RNFetchBlob.fs.readFile(PATH_TO_READ, 'base64')
.then((data) => {
// handle the data ..
})
编辑:我认为这个答案会帮助你解决这个问题
推荐阅读
- python - 使用 BeautifulSoup 进行 SRE 匹配时无法访问元素
- r - 如何用excel或r替换数据中的空白单元格?
- python - 指标有什么问题?
- javascript - JavaScript 中的 Closure、Callback、Promise 和它们之间的主要区别是什么?
- windows - 本地 TFS 发布错误的文件描述符
- javascript - Reactjs:单击时如何更改按钮样式
- inheritance - Solidity 继承:如何访问继承合约中的变量?
- php - 使用 coinbase php 库向外部发送比特币返回 422::Invalid amount
- excel - excel日期格式不会改变
- integration - 有没有人将 Kibana 与任何 IDS 集成?