【问题标题】:In a react-native android project,How to copy a folder from assets to the DocumentDirectoryPath?在 react-native android 项目中,如何将文件夹从资产复制到 DocumentDirectoryPath?
【发布时间】:2020-03-01 13:11:12
【问题描述】:

我正在使用一个 react-native 项目,我想将 android 内资产中某个文件夹的内容复制到 RNFS.DocumentDirectoryPath。如何执行此操作?

我使用了属性 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:

错误:无法打开资产“/ICF-Package”

【问题讨论】:

    标签: android react-native react-native-fs document-directory


    【解决方案1】:

    您的代码是正确的。但是,看起来/ICF-Package 是一个文件夹或其他东西,而不是一个文件。 copyFileAssets 只能复制文件,不能复制文件夹(及其内容)

    【讨论】:

      猜你喜欢
      • 2020-04-08
      • 2011-08-07
      • 2020-03-02
      • 1970-01-01
      • 2013-06-03
      • 1970-01-01
      • 1970-01-01
      • 2011-05-25
      • 2019-08-19
      相关资源
      最近更新 更多