itinance / itinance/react-native-fs

Just Seeking Clarification on Movement of Directories

Open
#1,099 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

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 `DirectoryPath`, where do the files in the above-organized architecture end up?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.