rn android log文件,RN文件上传(仅ios),下载,创建,删除等文件操作(兼容IOS和Android)--react-native-fs...

https://github.com/itinance/react-native-fs  //GitHub地址

具体用法参照GitHub

一.下载依赖

npm install react-native-fs --save

二.链接原生库

链接后重新编译,如果android还是报错用AS打开项目的Mainapplication.java文件夹,如果看到红字等找不到包的可把鼠标放上去,Alt+enter弹出解决

react-native link react-native-fs

三导入依赖

var RNFS = require('react-native-fs');

四.系统的几种路径:

MainBundlePath (String) The absolute path to the main bundle directory 。安卓undefined或报错,支持ios,主要bundle目录.

CachesDirectoryPath (String) The absolute path to the caches directory。ios和安卓都可用,缓存目录。

DocumentDirectoryPath (String) The absolute path to the document directory。ios和安卓都可用,文档目录.

TemporaryDirectoryPath (String) The absolute path to the temporary directory (iOS and Windows only)。

LibraryDirectoryPath (String) The absolute path to the NSLibraryDirectory (iOS only);

ExternalDirectoryPath (String) The absolute path to the external files, shared directory (android only)。外部存储目录android

ExternalStorageDirectoryPath (String) The absolute path to the external storage, shared directory (android only)

五.列出文件列表

base是自定义方法(不要误解),里面的东西才是我们要看的列出文件列表的代码。

base(){

RNFS.readDir(RNFS.Documen

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值