Bundling binary data that cannot fit in memory

Hi all,

I'm evaluating whether an idea of mine is feasible. It would involve bundling a significant amount of data into the watch app, and this data would be in a custom binary format. For the sake of this question, assume the amount of data is ~4MB. Small enough that it could realistically ship as a watch app, but too large to fit in memory.

It's read-only data. It would need to be in a custom format because that's the only way it could possibly fit on the watch (it would be tens of megs if expressed naively as a JSON structure).

From the docs, it looks like I can't just bundle multiple a large binary, open it, read from it at some offset into a ByteArray, and close it. There are "resources" but these can only be strings, images, JSON, etc- not ByteArrays.

The only approach I can think of would be to split the data into small chunks, stringify each chunk, load the required chunk as a string, manually parse it back into a binary structure, extract the information I need, and then allow the string resource to be freed by the reference counter. This sounds like it might work but also sounds like it isn't the intended use case for string resources, and the string encoding would add space overhead.

Any thoughts appreciated!