1 unstable release

0.1.0 Jan 23, 2021

#2058 in Encoding

MIT license

31KB
520 lines

Unified Bundler

Unified Bundler is a library to assist programs in bundling multiple sources into one. Is a fast, very generic, and flexible library.

Usage

[dependencies]
ub = "0.1.0"

Examples

See examples/ directory for a simple CLI tool.

License

This crate is licensed under the MIT license, and all contributions must also be.


lib.rs:

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.)

No runtime deps