Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save RomikMakavana/f7190456267f1d64b194eaa96678b177 to your computer and use it in GitHub Desktop.
Save RomikMakavana/f7190456267f1d64b194eaa96678b177 to your computer and use it in GitHub Desktop.
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