itinance / itinance/react-native-fs

`writeFile` on Android Simulator will not overwrite an existing file, but write over it

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

Description

I am using the `RNFS.writeFile(path, myObject, 'utf8');` method to write on a file specified by `path`. It works perfectly on iOS, but on Android Simulator it behaves strangely. When I use the command to write on a file that already exists, it will not completely overwrite the existing file, but it will write over it, keeping the existing content/string. The consequence is that if the existing file has a longer string than the string I am trying to write, the end of the string will be a broken thing, very weird.

I have tried to do `exists()` and `unlink()` in case the file exists before writing and it eliminates the bug. But the app becomes slower and if the user writes too fast I get some other annoying bugs because file does not exists when I try to read it.

Did anyone else had the same trouble as me?

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.