tarfile.TarFile.getmembers()

TarFile.getmembers() Return the members of the archive as a list of TarInfo objects. The list has the same order as the members in the archive.

tarfile.TarFile.getmember()

TarFile.getmember(name) Return a TarInfo object for member name. If name can not be found in the archive, KeyError is raised. Note If a member occurs more than once in the archive, its last occurrence is assumed to be the most up-to-date version.

tarfile.TarFile.extractfile()

TarFile.extractfile(member) Extract a member from the archive as a file object. member may be a filename or a TarInfo object. If member is a regular file or a link, an io.BufferedReader object is returned. Otherwise, None is returned. Changed in version 3.3: Return an io.BufferedReader object.

tarfile.TarFile.extractall()

TarFile.extractall(path=".", members=None, *, numeric_owner=False) Extract all members from the archive to the current working directory or directory path. If optional members is given, it must be a subset of the list returned by getmembers(). Directory information like owner, modification time and permissions are set after all members have been extracted. This is done to work around two problems: A directory’s modification time is reset each time a file is created in it. And, if a directory

tarfile.TarFile.extract()

TarFile.extract(member, path="", set_attrs=True, *, numeric_owner=False) Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. member may be a filename or a TarInfo object. You can specify a different directory using path. File attributes (owner, mtime, mode) are set unless set_attrs is false. If numeric_owner is True, the uid and gid numbers from the tarfile are used to set the owner/group for th

tarfile.TarFile.close()

TarFile.close() Close the TarFile. In write mode, two finishing zero blocks are appended to the archive.

tarfile.TarFile.addfile()

TarFile.addfile(tarinfo, fileobj=None) Add the TarInfo object tarinfo to the archive. If fileobj is given, it should be a binary file, and tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects directly, or by using gettarinfo().

tarfile.TarFile.add()

TarFile.add(name, arcname=None, recursive=True, exclude=None, *, filter=None) Add the file name to the archive. name may be any type of file (directory, fifo, symbolic link, etc.). If given, arcname specifies an alternative name for the file in the archive. Directories are added recursively by default. This can be avoided by setting recursive to False. If exclude is given, it must be a function that takes one filename argument and returns a boolean value. Depending on this value the respecti

tarfile.TarFile

class tarfile.TarFile Class for reading and writing tar archives. Do not use this class directly: use tarfile.open() instead. See TarFile Objects.

tarfile.TarError

exception tarfile.TarError Base class for all tarfile exceptions.