[][src]Crate ub

This is a lib and binary crate to bundle files to a single one, like zipping it without compression. Can bundle folders, and open bundles.

Current structure of file:

  • MAGIC_NUMBER
  • Version, version (u32), big endian u32 signaling the number of the bundle.
  • Here the header begins. Everything after this, up to where the file data start is part of the header.
  • Header size, header_size (u64): size of header including these 8 bytes (it starts directly after the version)
  • Size of path length path_length_bytes (u8): byte to indicate length of length of paths (a big endian value of 1 indicates a path's length will take 1 byte)
  • List of file meta entries files (no defined length, that is what the header size is for)
    • File size, file_size (u64): the file size. Used to calculate where the files are located in the file. (weak point for corruption, so maybe add a file_position too?)
    • Path length, path_length (u(path_length_bytes * 8); deserialize::UintParseType): how many bytes after of this will provide the path.
    • Path data, path ([u8; path_length]): the path for this file, used in extraction. I have plans to cluster these when files start with the same bytes to avoid repetition (have a group for a folder with many files, so the individual files don't need the whole path.)

Re-exports

pub use deserialize::parse;
pub use deserialize::File;
pub use deserialize::Files;
pub use serialize::walk_dir;
pub use serialize::write;

Modules

deserialize

Parsing module, including all versions and supporting structs and enums.

serialize

Serializes multiple objects to a single bundle.

Constants

MAGIC_NUMBER

The magic number associated with bundles. Used to offset all reading and when writing.