tarfile

Read from and write to tar format archives.

Functions

bltn_open open(name[, mode[, buffering]]) -> file object
calc_chksums(buf) Calculate the checksum for a member’s header by summing up all characters except for the chksum field which is treated as if it was filled with spaces.
copyfileobj(src, dst[, length]) Copy length bytes from fileobj src to fileobj dst.
filemode(mode) Convert a file’s mode to a string of the form -rwxrwxrwx.
is_tarfile(name) Return True if name points to a tar archive that we are able to handle, else return False.
itn(n[, digits, format]) Convert a python number to a number field.
nti(s) Convert a number field to a python number.
nts(s) Convert a null-terminated string field to a python string.
stn(s, length) Convert a python string to a null-terminated string buffer.
uts(s, encoding, errors) Convert a unicode object to a string.

Classes

ExFileObject(tarfile, tarinfo) File-like object for reading an archive member.
TarFile([name, mode, fileobj, format, ...]) The TarFile Class provides an interface to tar archives.
TarFileCompat(file[, mode, compression]) TarFile class compatible with standard module zipfile’s ZipFile class.
TarInfo([name]) Informational class which holds the details about an archive member given by a tar header block.
TarIter(tarfile) Iterator Class.

Exceptions

CompressionError Exception for unavailable compression methods.
EOFHeaderError Exception for end of file headers.
EmptyHeaderError Exception for empty headers.
ExtractError General exception for extract errors.
HeaderError Base exception for header errors.
InvalidHeaderError Exception for invalid headers.
ReadError Exception for unreadable tar archives.
StreamError Exception for unsupported operations on stream-like TarFiles.
SubsequentHeaderError Exception for missing and invalid extended headers.
TarError Base exception.
TruncatedHeaderError Exception for truncated headers.