React-native-fs: Path to file in Android package

Created on 21 Mar 2016  路  2Comments  路  Source: itinance/react-native-fs

I'm trying to use react-native-fs in conjunction with react-native-pdf-view. The goal is to bundle my app with a PDF file that can be displayed inside an Android app.

What I can't figure out is how to get a path to that PDF file that's inside the Android package. It's not in the files or caches folder, it's inside the Android package (bundle?) itself.

How can I get a path to that PDF file?

help wanted question

Most helpful comment

@bomalley See #83 - I've added readDirAssets to list files in the 'assets' folder. You can read the files with readFileAssets.

However, third-party components themselves will need to know how to open a file in the assets folder, as the fairly low-level method of reading asset files is different to that for 'normal' files on disk (e.g. SD Card).

All 2 comments

@bomalley Sorry, I'm not very well versed with Android. I'll leave this issue open, so maybe someone else is able to help.

@bomalley See #83 - I've added readDirAssets to list files in the 'assets' folder. You can read the files with readFileAssets.

However, third-party components themselves will need to know how to open a file in the assets folder, as the fairly low-level method of reading asset files is different to that for 'normal' files on disk (e.g. SD Card).

Was this page helpful?
0 / 5 - 0 ratings