Skip to main content

unpack

Function unpack 

Source
pub fn unpack<R: Read>(
    reader: R,
    dest: &Path,
    overwrite: bool,
    platform: Platform,
) -> Result<Unpacked, Failure>
Expand description

Writes the archive read from reader to dest, following the destination rule of cp -r.

The root entry decides everything before anything is written: the final path, the refusal when it exists and overwrite is off, and the refusal of a file against a folder. The same checks run again for every entry of a folder, so a merge replaces same-named files and keeps the others. Files are written under a temporary name and renamed into place, and an unfinished temporary file is removed on every failure.

Entries with an absolute path or .. stop the transfer. An entry whose path goes through a symbolic link or a file is refused, so links made by the archive cannot lead later entries outside the destination. Names platform cannot hold, and links it cannot create, are skipped and listed.

ยงErrors

Fails with the reason and how far the transfer got.