[][src]Struct async_tar::Archive

pub struct Archive<R: Read + Unpin> { /* fields omitted */ }

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 + Unpin + Sync + Send> Archive<R>[src]

pub fn new(obj: R) -> Archive<R>[src]

Create a new archive with the underlying object as the reader.

pub fn into_inner(self) -> Result<R, Self>[src]

Unwrap this archive, returning the underlying object.

pub fn entries(&mut self) -> Result<Entries<R>>[src]

Construct an stream 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 stream returns), then the contents read for each entry may be corrupted.

pub fn entries_raw(&mut self) -> Result<RawEntries<R>>[src]

Construct an stream over the raw 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 stream returns), then the contents read for each entry may be corrupted.

pub async fn unpack<'_, P: AsRef<Path>>(&'_ mut self, dst: P) -> Result<()>[src]

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 async_std::fs::File;
use async_tar::Archive;

let mut ar = Archive::new(File::open("foo.tar").await?);
ar.unpack("foo").await?;

Trait Implementations

impl<R: Read + Unpin> AsyncRead for Archive<R>[src]

impl<R: Read + Unpin> Clone for Archive<R>[src]

impl<R: Debug + Read + Unpin> Debug for Archive<R>[src]

Auto Trait Implementations

impl<R> !RefUnwindSafe for Archive<R>

impl<R> !Send for Archive<R>

impl<R> !Sync for Archive<R>

impl<R> Unpin for Archive<R>

impl<R> !UnwindSafe for Archive<R>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ReadExt for T where
    T: AsyncRead + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.