Open ShivamJoker opened 1 year ago
Here is an example of reading data from android assets: https://github.com/alpha0010/react-native-file-access/blob/v3.0.4/example/src/App.tsx#L31-L36 (targets this file).
Why do we need to copy the file every time I need to read it?
It would be great if we could directly read from the app res directory.
Main reason is I never needed to read assets in my projects, so I did not spend time programming it. For my projects, assets have been binary files (e.g. databases, images) unpacked to a specific location for other native code to handle; not any content I needed to see from JS side.
I am open to suggestions on how to make this easier to use. A difficulty is I would prefer to avoid bloating API by adding a bunch of xxAsset()
functions to mirror the plain file functions. Any thoughts on how to augment the existing API to support referencing assets whenever used as a readonly file?
If possible it would be best to add the assets in the directory constants itself. Eg. Dirs.Assets
.
Then we will be able to use all the existing APIs and we can remove cpAssets
as well if we want.
Feature Right now I am not sure how can I read file which is in
android\app\src\main\assets
Motivation I have markdown file which I want to read and render.