packed: add ability to load from memory, add MapAndLoad

The ability to load a packfile from memory means that it becomes easy to
use the "embed" package to embed a small packfile.

The refactor to allow loading from memory also makes it easy to add a
MapAndLoad implementation, which means the file only needs to be opened
/ mmap()ed once.
This commit is contained in:
Laurence Withers 2026-06-06 10:16:40 +01:00
commit 4ed5335a07
4 changed files with 154 additions and 33 deletions

BIN
packed/testdata/helloworld.pack vendored Normal file

Binary file not shown.

13
packed/testdata/helloworld.txt vendored Normal file
View file

@ -0,0 +1,13 @@
Hello, world
This file contains a few lines of plain text, really just enough
to trigger the "compression worthwhile" heuristic.
This file contains a few lines of plain text, really just enough
to trigger the "compression worthwhile" heuristic.
This file contains a few lines of plain text, really just enough
to trigger the "compression worthwhile" heuristic.
This file contains a few lines of plain text, really just enough
to trigger the "compression worthwhile" heuristic.