Hello Friends,

Welcome To Infinitbility!

This article will help you to check your file exist or not in react native using react-native-fs library.

Here, we are use react-native-fs library to check file available or not.

Let’s start today’s topic How to check file is exist or not in react native

react-native-fs provide exists component to verify file available or not in device it works on both platform (android, and iOS).

exists(filepath: string): Promise<boolean>

react-native-fs exists function required filepath and it wil return boolean values with promise whitch means you have to use await for get proper result.


First we have need to install react-native-fs library on our project.

npm install react-native-fs --save

Extra steps for iOS Installation

  • add below code to your podfile
pod 'RNFS', :path => '../node_modules/react-native-fs'
  • install library
pod install

react-native-fs exists example

Here, i am sharing how i check file exists or not in device, you have to just pass filepath to exists function with await.

let’s understand with code example.

  • add below code top of your file
// require the module
var RNFS = require('react-native-fs');
  • exists usebility
async function verifyFiles(filepath) {
    let exists = await RNFS.exists(filepath);
    console.log("exists", exists); // true or false

Thanks for reading…