admin管理员组文章数量:1323729
I need to check file existence in the folder like this:
file:///android_asset/contents/my.html
I've tried to use react-native-filesystem plugin
ponentWillMount () {
async function checkIfFileExists() {
const fileExists = await FileSystem.fileExists('file:///android_asset/contents/my.html')
console.log(`file exists: ${fileExists}`)
}
}
I'm sure that my.html file is there, but I get false in fileExists. Does anybody know how to check it properly?
I need to check file existence in the folder like this:
file:///android_asset/contents/my.html
I've tried to use react-native-filesystem plugin
ponentWillMount () {
async function checkIfFileExists() {
const fileExists = await FileSystem.fileExists('file:///android_asset/contents/my.html')
console.log(`file exists: ${fileExists}`)
}
}
I'm sure that my.html file is there, but I get false in fileExists. Does anybody know how to check it properly?
Share Improve this question asked Apr 18, 2017 at 11:33 DmitryDmitry 8673 gold badges16 silver badges31 bronze badges 1- i think react native has nothing to do with this. what you say. – Hammad Tariq Commented Apr 18, 2017 at 11:53
1 Answer
Reset to default 2Try using react-native-fs
.
Looks like they have a function to just what you're looking for: https://github./johanneslumpe/react-native-fs#existsassetsfilepath-string-promiseboolean
本文标签:
版权声明:本文标题:javascript - React Native: Is there any way to check if the file exists in android_asset folder or not? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742120210a2421659.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论