react-native-fs
react-native-fs copied to clipboard
Just Seeking Clarification on Movement of Directories
I've got the following file architecture for my React Native project:
.
+-- __tests__
[*snip*]
+-- screens
| +-- Settings.js
+-- userdata
| +-- userdata.json
[*snip*]
App.js
And I'd like to read and overwrite userdata.json. However, I can't identify the path where to find the document at build. Here's the relevant snippet from Settings.js:
import { DocumentDirectoryPath, exists, readFile, writeFile } from 'react-native-fs';
var userSettings = readFile(DocumentDirectoryPath + 'userdata/userdata.json', 'utf8')
.then((success) => {console.log(success);})
.catch((error) => {console.log(error.message);});
I've tried various approaches on the path parameter, but none of them find the JSON file in the build. So, generally speaking, relative to whatever <Named>DirectoryPath, where do the files in the above-organized architecture end up?