Ask questionsAccessing static assets


Let's say I would like to use static assets (such as text files, png's, etc) in a node app on Android. I noticed we have service.getProcess().exposeHostDirectory, and it feels like this would be a good way to expose a folder containing the static assets, but it's unclear where such a folder should go.

Android also gives us context.getAssets(), but it seems that Android bundles their static assets in a way that's incompatible with the more traditional file directory structure model expected by node.

Is serving static assets a supported scenario in LiquidCore?


Answer questions ericwlange

I'm afraid that assets won't be accessible through the filesystem. IIRC, android stores them in some binary (zip?) format. You can only get access to them through context.getAssets().open(), which provides a read stream. Thus they are not part of the filesystem, per se, so they won't be accessible using fs operations. This is a good feature request, though. I can see creating an API method that calls back to Android to get stream access to an Android asset.


Related questions

No questions were found.
Github User Rank List