3

I am using a react-native project in which,I want to copy the contents of a certain folder in assets inside android to RNFS.DocumentDirectoryPath. How can this be performed?

I have used the attribute copyFileAssets().

 copyfile() {
    RNFS.copyFileAssets('/ICF-Package', RNFS.DocumentDirectoryPath + '/ICFPackage').then((result) => console.log('DONE')).catch((error) => console.log(error, 'ERROR'));
  };

  I'm getting the following error:

Error: Asset '/ICF-Package' could not be opened

Aishwarya R M
  • 123
  • 1
  • 10

1 Answers1

0

Your code is correct. However, it looks like /ICF-Package is a folder or something, but not a file. copyFileAssets can only copy files, but no folders (and its content)

four-eyes
  • 10,740
  • 29
  • 111
  • 220