HarmonyOS react-native-fs使用问题?

1.该库如何获取沙箱路径

2.react-native-fs这个下载文件到沙箱路径该如何使用

阅读 544
1 个回答

可以参考一下如下demo,这个是fs的path

<View style={{  padding: 20 }}>
<View>
  <Text style={{fontSize:13,color:"red"}}>
当前库为文件操作库 不存在页面效果请关注文件系统变更{"\n"}
相关资料链接:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/app-sandbox-directory-0000001774280086
</Text>
  </View>
  <View style={styles.sectionDescription}>
  <Text>FS.DocumentDirectoryPath:{"\n"}{RNFS.DocumentDirectoryPath}</Text>
  </View>
  <View style={styles.sectionDescription}>
  <Text>FS.CachesDirectoryPath:{RNFS.CachesDirectoryPath}</Text>
  </View>
  <View style={styles.sectionDescription}>
  <Text>FS.MainBundlePath:{"\n"}{RNFS.MainBundlePath}</Text>
  </View>
  <View style={styles.sectionDescription}>
  <Text>FS.TemporaryDirectoryPath:{"\n"}{RNFS.TemporaryDirectoryPath}</Text>
  </View>
  <View style={styles.sectionDescription}>
  <Text>FS.LibraryDirectoryPath:{"\n"}{RNFS.LibraryDirectoryPath}</Text>
  </View>
  </View>
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进