Struct tar::Archive [−][src]
A top-level representation of an archive file.
This archive can have an entry added to it and it can be iterated over.
Methods
impl<R: Read> Archive<R>
[src]
impl<R: Read> Archive<R>
pub fn new(obj: R) -> Archive<R>
[src]
pub fn new(obj: R) -> Archive<R>
Create a new archive with the underlying object as the reader.
pub fn into_inner(self) -> R
[src]
pub fn into_inner(self) -> R
Unwrap this archive, returning the underlying object.
pub fn entries(&mut self) -> Result<Entries<R>>
[src]
pub fn entries(&mut self) -> Result<Entries<R>>
Construct an iterator over the entries in this archive.
Note that care must be taken to consider each entry within an archive in sequence. If entries are processed out of sequence (from what the iterator returns), then the contents read for each entry may be corrupted.
pub fn unpack<P: AsRef<Path>>(&mut self, dst: P) -> Result<()>
[src]
pub fn unpack<P: AsRef<Path>>(&mut self, dst: P) -> Result<()>
Unpacks the contents tarball into the specified dst
.
This function will iterate over the entire contents of this tarball, extracting each file in turn to the location specified by the entry's path name.
This operation is relatively sensitive in that it will not write files
outside of the path specified by dst
. Files in the archive which have
a '..' in their path are skipped during the unpacking process.
Examples
use std::fs::File; use tar::Archive; let mut ar = Archive::new(File::open("foo.tar").unwrap()); ar.unpack("foo").unwrap();
pub fn set_unpack_xattrs(&mut self, unpack_xattrs: bool)
[src]
pub fn set_unpack_xattrs(&mut self, unpack_xattrs: bool)
Indicate whether extended file attributes (xattrs on Unix) are preserved when unpacking this archive.
This flag is disabled by default and is currently only implemented on Unix using xattr support. This may eventually be implemented for Windows, however, if other archive implementations are found which do this as well.
pub fn set_preserve_permissions(&mut self, preserve: bool)
[src]
pub fn set_preserve_permissions(&mut self, preserve: bool)
Indicate whether extended permissions (like suid on Unix) are preserved when unpacking this entry.
This flag is disabled by default and is currently only implemented on Unix.