itinance / itinance/react-native-fs

Documentation out of date for writeFile (also: write, appendFile)

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

Description

The API docs in the README have the signature as follows for writeFile:

`writeFile(filepath: string, contents: string, encoding?: string): Promise`

However, the following description states:

`options optionally takes an object specifying the file's properties, like mode etc.`

Given the signature listed, I would not have expected an options object. Looking at the code, I see that the signature for writeFile is:

`writeFile(filepath: string, contents: string, encodingOrOptions?: any): Promise`

I believe the solution to this would be to add `encodingOrOptions?` to the function signature in the documentation. I also noticed while looking at the code that the final parameter for both `write` and `appendFile` is `encodingOrOptions?: any`, not `encoding?: string`.

If my understanding of the situation is accurate and it's agreed that the signatures in the documentation (and the descriptions to `write` and `appendFile`) should be updated to include this information, I'd be happy to submit a PR with the changes.

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.