Created
February 21, 2023 05:42
-
-
Save RomikMakavana/f7190456267f1d64b194eaa96678b177 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Platform, NativeModules } from 'react-native'; | |
const { FileSystem } = NativeModules; | |
const path = `${FileSystem.documentDirectory}/myFile.txt`; | |
FileSystem.getInfo(path) | |
.then(stats => { | |
if (stats.exists) { | |
console.log('File exists'); | |
} else { | |
console.log('File does not exist'); | |
} | |
}) | |
.catch(error => { | |
console.log(error); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment