首页 > 解决方案 > 如何在本机反应中将捆绑文件复制到文档目录

问题描述

我的包中有 json 文件。我想将文件复制到文档目录。

   var path = RNFS.DocumentDirectoryPath + '/data.json';

 RNFS.copyFile(`${RNFS.MainBundlePath}/assests/resource/data.json`, path)
    .then(() => {
        console.log('FILE COPIED');

    })
    .catch((err) => {
        console.log(err.message);
    });



The file “data.json” couldn’t be opened because there is no such file.

标签: androidiosreact-native

解决方案


推荐阅读