expo file system

I want to use expo file system to download a file from my server. can any one help me ?

  FileSystem.documentDirectory + 'small.mp4'
  .then(({ uri }) => {
    console.log('Finished downloading to ', uri);
  .catch(error => {

I have used this code , it show me the url but where to find this file after download?

The downloaded file will be saved to FileSystem.documentDirectory + 'small.mp4' so to access it later you will need to have a reference to this file path, which would be something like: file://Containers/Data/Application/55651607-FE3D-4AA1-8106-1AA7AC8BEBBD/Documents/small.mp4.

A few options:

  1. Use AsyncStorage to save a reference to read back later.
  2. Use Redux / Redux persist (also with AsyncStorage) to hold the reference

You will need to read the files from that created directory as well, so:

const files = await FileSystem.readDirectoryAsync(<YOUR_FILE_DIRECTORY>);

1 Like


This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.