import RNFS from 'react-native-fs';
读取文件内容
comparePrivateFile(now){
this.setState({
readLoading:true
});
const path = '/sdcard/Handheld/android_log';
return RNFS.readFile(path)
.then((result) => {
console.log("读取到文件的内容",result)
})
.catch((err) => {
console.log(err.message);
});
}
复制文件
copySelf(now){
this.setState({
newMatchVisible:false
});
const path = "/sdcard/Handheld/"+now+".db";
const path1 ="/sdcard/Handheld/private.db";
return RNFS.copyFile(path,path1)
.then((result) => {
console.log("复制path路径文件到path1",result);
})
.catch((err) => {
console.log(err.message);
});
}