[英]In a react-native android project,How to copy a folder from assets to the DocumentDirectoryPath?
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.我正在使用 react-native 项目,我想将 android 内资产中某个文件夹的内容复制到 RNFS.DocumentDirectoryPath。 How can this be performed?如何执行此操作?
I have used the attribute copyFileAssets().我使用了属性 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错误:无法打开资产“/ICF-Package”
Your code is correct.你的代码是正确的。 However, it looks like /ICF-Package
is a folder or something, but not a file.但是,看起来/ICF-Package
是文件夹或其他东西,而不是文件。 copyFileAssets
can only copy files, but no folders (and its content) copyFileAssets
只能复制文件,不能复制文件夹(及其内容)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.