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
componentWillMount () {
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?
Try using react-native-fs
.
Looks like they have a function to just what you're looking for: https://github.com/johanneslumpe/react-native-fs#existsassetsfilepath-string-promiseboolean
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With