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 cd9c8b600e
4 changed files with 154 additions and 33 deletions

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.