Open ghost opened 7 years ago
I'm wondering whether this library works at all on Android 7?
saveToFile = async(data) => {
const fileContent = JSON.stringify(data);
await FileSystem.writeToFile('data/test-2.txt', fileContent, FileSystem.storage.important);
console.log('file is saved!!!!!!!!!!')
}
logs indeed file is saved. However,
readFromFile = async() => {
const fileContent = await FileSystem.readFile('data/test-2.txt');
console.log('data from file')
console.log(fileContent)
}
yields an unhandled promise rejection warning:
File was not found: data/test-2.txt
You have to read the file from the same storage class as it is written. In your case:
const fileContent = await FileSystem.readFile('data/test-2.txt', FileSystem.storage.important);
My bad, thanks.
Back to my first question: Is there a way to locate the saved file from Android File Manager or any third party File Manager?
I'm not very familiar with these File Managers, but I would very much assume so. If you look at the API Reference, it says something about the location of the different storage classes, and the abolutePath-method will give you the exact location of the file.
Is there a way to locate the saved file using a File Manager. I'm using storage option FileSystem.storage.important but can't find it anywhere. Use case: transfer file to a computer