Algorithm for packing files into archive and fast access
Posted: Wed Nov 14, 2012 5:51 am
What's a fast way to pack together a bunch of files with a reasonably fast way to index them?
I can build the table and the data separately, like for each file, create an entry for the file, and put the file data in a buffer. Then, combine the table and data sections together and then increment all offsets in the table to the start of the data sections.
Or perhaps...
Which means I don't have to worry about keeping track of my data I just need to write as I go.
Except I guess the problem is that if you want to find a file you need to loop through every entry...
Code: Select all
File Table
File Data
Or perhaps...
Code: Select all
entry_header 1
entry_data 1
entry_header 2
entry_data 2
...
Except I guess the problem is that if you want to find a file you need to loop through every entry...