A Brief Look Inside HPKG | Haiku Project

@leavengood I found it slightly confusing too. My read is that there are n chunks, and each chunk (except the last) represents 64kb of real, uncompressed data. They are stored compressed, and the index at the end contains those compressed lengths so you know what to decompress.

So you want to start reading from the start of data? Decompress the first chunk and use it. Let’s say it contains an index into byte 100,000. You know that’ll be in the second chunk because it covers bytes 65,536~131,071, so look at the index at the end of the file to know which bytes cover the compressed chunk two, then read and decompress that.