7.19.2 TarInfo Objects
A TarInfo object represents one member in a TarFile.
Aside from storing all required attributes of a file (like file type, size, time, permissions,
owner etc.), it provides some useful methods to determine its type. It does not contain
the file's data itself.
TarInfo objects are returned by
- Create a TarInfo object.
- Create and return a TarInfo object from a string buffer.
- Create a string buffer from a TarInfo object.
TarInfo object has the following public data attributes:
- Name of the archive member.
- Size in bytes.
- Time of last modification.
- Permission bits.
- File type. type is usually one of these constants:
LNKTYPE, SYMTYPE, DIRTYPE, FIFOTYPE, CONTTYPE, CHRTYPE, BLKTYPE, GNUTYPE_SPARSE. To
determine the type of a TarInfo object more conveniently, use the
- Name of the target file name, which is only present in TarInfo
objects of type LNKTYPE and SYMTYPE.
- uid, gid
- User and group ID of who originally stored this member.
- uname, gname
- User and group name.
A TarInfo object also provides some convenient query methods:
True if the Tarinfo object is a regular file.
- Same as isfile().
True if it is a directory.
True if it is a symbolic link.
True if it is a hard link.
True if it is a character device.
True if it is a block device.
True if it is a FIFO.
True if it is one of character device, block device or FIFO.