SimpleArchiver/file_format.md
Stephen Seo eb1f09b551
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
Revise file_format
The changes should allow for the .simplearchive file to be directly
outputted to standard out in a single pass.

Resolves #10 .
2024-07-02 14:02:38 +09:00

38 lines
1.3 KiB
Markdown

# File Format
## Format Version 0
File extension is "*.simplearchive"
First 18 bytes of file will be:
SIMPLE_ARCHIVE_VER
Next 2 bytes is 16-bit unsigned integer "version" in big-endian. In this case,
it will be zero.
Next 4 bytes are bit-flags.
1. The first byte
1. The first bit is set if de/compressor is set for this archive.
The remaining unused flags are reserved for future revisions and are currently
ignored.
If the previous "de/compressor is set" flag is enabled, then the next section is
added:
1. 2 bytes is 16-bit unsigned integer "compressor cmd+args" in big-endian.
2. X bytes of "compressor cmd+args" (length defined by previous value).
3. 2 bytes is 16-bit unsigned integer "decompressor cmd+args" in big-endian.
4. X bytes of "decompressor cmd+args" (length defined by previous value).
The next 4 bytes is 32-bit unsigned integer "file count" in big-endian which
will indicate the number of files in this archive.
Following the file-count bytes, the following bytes are added for each file:
1. 2 bytes is 16-bit unsigned integer "filename length" in big-endian.
2. X bytes of filename (length defined by previous value).
3. 8 bytes 64-bit unsigned integer "size of filename in this archive file".
4. X bytes file data (length defined by previous value).