···1313| `0x00` | **Header** | 8-byte magic identification string. |
1414| `0x08` | **Data Payload** | Sequential blobs of raw or compressed data. |
1515| `Variable` | **Index** | A sequence of metadata entries and filenames. |
1616-| `EOF - 20` | **Footer** | Pointer to the index and file count. |
1616+| `EOF - 16` | **Footer** | Pointer to the index and file count. |
17171818---
1919···4040| `name_len` | 2 bytes | u16 | Length of the following filename string. |
4141| `comp_type` | 1 byte | u8 | `0` = Raw, `1` = Zstd. |
4242| `reserved` | 1 byte | u8 | Alignment padding. |
4343+| `filename` | variable | utf8 | Filename string
43444445**Padding:** After the filename string, the file MUST be padded with null bytes until the next 8-byte boundary is reached.
45464647### 2.4 Footer
4747-The last 20 bytes of the file contain the lookup information required to parse the archive.
4848+The last 16 bytes of the file contain the lookup information required to parse the archive.
48494950| Field | Size | Type | Description |
5051| :--- | :--- | :--- | :--- |
5152| `index_offset` | 8 bytes | u64 | Absolute offset to the start of the Index. |
5252-| `entry_count` | 4 bytes | u32 | Total number of entries in the file. |
5353+| `entry_count` | 8 bytes | u32 | Total number of entries in the file. |
53545455---
5556···5960To read a Bindle file:
60611. Validate the file size (must be at least 28 bytes).
61622. Read the first 8 bytes and the last 8 bytes to verify the `BINDL001` magic.
6262-3. Read the `index_offset` from the footer (EOF - 20).
6363+3. Read the `index_offset` from the footer (EOF - 16).
63644. Seek to `index_offset` and iterate `entry_count` times to populate an in-memory map of files.
64656566### 3.2 Writing Logic (Atomic Updates)
+3-3
src/lib.rs
···3030#[derive(FromBytes, Unaligned, IntoBytes, Immutable, Debug)]
3131struct Footer {
3232 pub index_offset: [u8; 8],
3333- pub entry_count: [u8; 4],
3333+ pub entry_count: [u8; 8],
3434}
35353636pub struct Bindle {
···88888989 // If magic is valid, proceed to parse the index
9090 let data_end = u64::from_le_bytes(footer.index_offset);
9191- let count = u32::from_le_bytes(footer.entry_count);
9191+ let count = u64::from_le_bytes(footer.entry_count);
9292 let mut entries = Vec::with_capacity(count as usize);
93939494 let mut cursor = data_end as usize;
···244244245245 let footer = Footer {
246246 index_offset: index_start.to_le_bytes(),
247247- entry_count: (self.entries.len() as u32).to_le_bytes(),
247247+ entry_count: (self.entries.len() as u64).to_le_bytes(),
248248 };
249249250250 self.file.write_all(footer.as_bytes())?;