可以手动遍历,读取rawfile下的目录和文件信息参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-resource-manager-V5\#getrawfilelistsync10https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-file-fs-V5将rawfile下文件拷贝至沙箱可参考示例如下:getContext(this).resourceManager.getRawFileContent('test.txt', (_err, value) => { let myBuffer: ArrayBufferLike = value.buffer let context = getContext(this); //沙箱路径 let filePath = context.filesDir + "/test.txt"; console.log("testTag-filePath:" + filePath); let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); let writeLen = fs.writeSync(file.fd, myBuffer); console.info("testTag-write data to file succeed and size is:" + writeLen); fs.closeSync(file); });
可以手动遍历,读取rawfile下的目录和文件信息参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-resource-manager-V5\#getrawfilelistsync10
https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-file-fs-V5
将rawfile下文件拷贝至沙箱可参考示例如下: