Skip to main content

pack_with

Function pack_with 

Source
pub fn pack_with(
    src: &Path,
    out: &Path,
    extra: &[(&str, Vec<u8>)],
    max_volume: u64,
) -> Result<(usize, usize)>
Expand description

Like pack, with an explicit maximum volume size. Returns (files, volumes).

The archive is an index file (out, e.g. game.pak) plus data volumes next to it (game.000.pkd, game.001.pkd…). Files are spread over the volumes largest-first so each volume ends up close to the limit and the volumes are of similar size; a file larger than the limit gets a volume of its own. Data is streamed to disk file by file, so packing a multi-gigabyte project does not need that much memory.