Closed vatsalkgor closed 3 years ago
Same Problem here :(
Hi @mohsenzia
I ended up doing the following:
let date = new Date();
const dir =
Platform.OS === "ios"
? RNFetchBlob.fs.dirs.DocumentDir + "/" + date + ".txt"
: RNFetchBlob.fs.dirs.DownloadDir + "/" + date + ".txt";
RNFetchBlob.fs
.writeStream(
//Not Sure if DownloadDir works on iOS
dir,
"utf8",
false
).then(stream => {
logsArray.forEach((sentence, index) => {
stream.write(sentence + "\r\n");
});
stream.close();
return stream;
})
.then(() => {
const path =
Platform.OS === "ios"
? RNFetchBlob.fs.dirs.DocumentDir +
"/" +
date +
".txt"
: RNFetchBlob.fs.dirs.DownloadDir +
"/" +
date +
".txt";
logsArray = [];
// send mail logic here
})
Hi I am trying to log some events that my app performs and then email it to concerned person. Below is my code snippet.
The problem is if i use the DownloadDir, the file is saved into the download directory in android (DownloadDir not supported in ios). But if I use DocumentDir then the file is not saved in android (not checked in ios)and there's no error occurred as well. I was wondering where I went wrong and wanted some feedbacks. I also want to ask does DocumentDir only works for ios or does it supports android also.
RN VERSION: 0.61.5 rn-fetch-blob: 0.11.2