phrohdoh / easage

A library that provides programmatic manipulation of BIG archives.
MIT License
9 stars 0 forks source link

Rewrite archive 'packing' to be more flexible #41

Closed phrohdoh closed 6 years ago

phrohdoh commented 6 years ago

Currently we only support 'packing' a directory recursively.

Ideally a user of the library would be able to pack any (name, data) items into an archive.

Possible function signatures (not the only options though!):

pub fn pack(items: Vec<(String, &[u8])>, settings: Settings) -> Result<Archive>;
pub fn pack(items: Vec<(String, &[u8])>, settings: Settings) -> Result<Vec<u8>>;
pub fn pack(buf: &mut [u8], items: Vec<(String, &[u8])>, settings: Settings) -> Result<usize>;

At this point library users could pack from a (collected) TCP stream if they felt so inclined.


Note: This will make unit testing the contents of an Archive simple (ref https://github.com/Phrohdoh/easage/issues/38).