💾 Archived View for tris.fyi › pydoc › tarfile captured on 2023-01-29 at 03:34:52. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-07-16)

🚧 View Differences

-=-=-=-=-=-=-

Back to module index

Go to module by name

tarfile

Read from and write to tar format archives.

Classes

CompressionError

Exception for unavailable compression methods.
with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

EOFHeaderError

Exception for end of file headers.
with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

EmptyHeaderError

Exception for empty headers.
with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

ExFileObject

close(...)
detach(...)
fileno(...)
flush(...)
isatty(...)
peek(self, size=0, /)
read(self, size=-1, /)
read1(self, size=-1, /)
readable(...)
readinto(self, buffer, /)
readinto1(self, buffer, /)
readline(self, size=-1, /)
readlines(self, hint=-1, /)

  Return a list of lines from the stream.

  hint can be specified to control the number of lines read: no more
  lines will be read if the total size (in bytes/characters) of all
  lines so far exceeds hint.
seek(self, target, whence=0, /)
seekable(...)
tell(...)
truncate(self, pos=None, /)
writable(self, /)

  Return whether object was opened for writing.

  If False, write() will raise OSError.
write(...)

  Write the given buffer to the IO stream.

  Returns the number of bytes written, which is always the length of b
  in bytes.

  Raises BlockingIOError if the buffer is full and the
  underlying raw stream cannot accept more data at the moment.

writelines(self, lines, /)

  Write a list of lines to stream.

  Line separators are not added, so it is usual for each of the
  lines provided to have a line separator at the end.
closed = <attribute 'closed' of '_io.BufferedReader' objects>
mode = <attribute 'mode' of '_io.BufferedReader' objects>
name = <attribute 'name' of '_io.BufferedReader' objects>
raw = <member 'raw' of '_io.BufferedReader' objects>

ExtractError

General exception for extract errors.
with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

HeaderError

Base exception for header errors.
with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

InvalidHeaderError

Exception for invalid headers.
with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

ReadError

Exception for unreadable tar archives.
with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

StreamError

Exception for unsupported operations on stream-like TarFiles.
with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

SubsequentHeaderError

Exception for missing and invalid extended headers.
with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

TarError

Base exception.
with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

TarFile

The TarFile Class provides an interface to tar archives.
    

xzopen.ExFileObject

close(...)
detach(...)
fileno(...)
flush(...)
isatty(...)
peek(self, size=0, /)
read(self, size=-1, /)
read1(self, size=-1, /)
readable(...)
readinto(self, buffer, /)
readinto1(self, buffer, /)
readline(self, size=-1, /)
readlines(self, hint=-1, /)

  Return a list of lines from the stream.

  hint can be specified to control the number of lines read: no more
  lines will be read if the total size (in bytes/characters) of all
  lines so far exceeds hint.
seek(self, target, whence=0, /)
seekable(...)
tell(...)
truncate(self, pos=None, /)
writable(self, /)

  Return whether object was opened for writing.

  If False, write() will raise OSError.
write(...)

  Write the given buffer to the IO stream.

  Returns the number of bytes written, which is always the length of b
  in bytes.

  Raises BlockingIOError if the buffer is full and the
  underlying raw stream cannot accept more data at the moment.

writelines(self, lines, /)

  Write a list of lines to stream.

  Line separators are not added, so it is usual for each of the
  lines provided to have a line separator at the end.
closed = <attribute 'closed' of '_io.BufferedReader' objects>
mode = <attribute 'mode' of '_io.BufferedReader' objects>
name = <attribute 'name' of '_io.BufferedReader' objects>
raw = <member 'raw' of '_io.BufferedReader' objects>

xzopen.TarInfo

Informational class which holds the details about an
       archive member given by a tar header block.
       TarInfo objects are returned by TarFile.getmember(),
       TarFile.getmembers() and TarFile.gettarinfo() and are
       usually created internally.
    
create_gnu_header(self, info, encoding, errors)

  Return the object as a GNU header block sequence.
        
create_pax_global_header(pax_headers)

  Return the object as a pax global header block sequence.
        
create_pax_header(self, info, encoding)

  Return the object as a ustar header block. If it cannot be
             represented this way, prepend a pax extended header sequence
             with supplement information.
        
create_ustar_header(self, info, encoding, errors)

  Return the object as a ustar header block.
        
frombuf(buf, encoding, errors)

  Construct a TarInfo object from a 512 byte bytes object.
        
fromtarfile(tarfile)

  Return the next TarInfo object from TarFile object
             tarfile.
        
get_info(self)

  Return the TarInfo's attributes as a dictionary.
        
isblk(self)

  Return True if it is a block device.
ischr(self)

  Return True if it is a character device.
isdev(self)

  Return True if it is one of character device, block device or FIFO.
isdir(self)

  Return True if it is a directory.
isfifo(self)

  Return True if it is a FIFO.
isfile(self)

  Return True if the Tarinfo object is a regular file.
islnk(self)

  Return True if it is a hard link.
isreg(self)

  Return True if the Tarinfo object is a regular file.
issparse(self)
issym(self)

  Return True if it is a symbolic link.
tobuf(self, format=2, encoding='utf-8', errors='surrogateescape')

  Return a tar header as a string of 512 byte blocks.
        
chksum = <member 'chksum' of 'TarInfo' objects>
devmajor = <member 'devmajor' of 'TarInfo' objects>
devminor = <member 'devminor' of 'TarInfo' objects>
gid = <member 'gid' of 'TarInfo' objects>
gname = <member 'gname' of 'TarInfo' objects>
linkname = <member 'linkname' of 'TarInfo' objects>
linkpath = <property object at 0x7f75e0a3ca90>
  In pax headers, "linkname" is called "linkpath".
mode = <member 'mode' of 'TarInfo' objects>
mtime = <member 'mtime' of 'TarInfo' objects>
name = <member 'name' of 'TarInfo' objects>
offset = <member 'offset' of 'TarInfo' objects>
offset_data = <member 'offset_data' of 'TarInfo' objects>
path = <property object at 0x7f75e0a3ca40>
  In pax headers, "name" is called "path".
pax_headers = <member 'pax_headers' of 'TarInfo' objects>
size = <member 'size' of 'TarInfo' objects>
sparse = <member 'sparse' of 'TarInfo' objects>
tarfile = <member 'tarfile' of 'TarInfo' objects>
type = <member 'type' of 'TarInfo' objects>
uid = <member 'uid' of 'TarInfo' objects>
uname = <member 'uname' of 'TarInfo' objects>
add(self, name, arcname=None, recursive=True, *, 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. `filter' is a function
             that expects a TarInfo object argument and returns the changed
             TarInfo object, if it returns None the TarInfo object will be
             excluded from the archive.
        
addfile(self, 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().
        
bz2open(name, mode='r', fileobj=None, compresslevel=9, **kwargs)

  Open bzip2 compressed tar archive name for reading or writing.
             Appending is not allowed.
        
chmod(self, tarinfo, targetpath)

  Set file permissions of targetpath according to tarinfo.
        
chown(self, tarinfo, targetpath, numeric_owner)

  Set owner of targetpath according to tarinfo. If numeric_owner
             is True, use .gid/.uid instead of .gname/.uname. If numeric_owner
             is False, fall back to .gid/.uid when the search based on name
             fails.
        
close(self)

  Close the TarFile. In write-mode, two finishing zero blocks are
             appended to the archive.
        
extract(self, 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, only the numbers for user/group names are used and not
             the names.
        
extractall(self, path='.', members=None, *, numeric_owner=False)

  Extract all members from the archive to the current working
             directory and set owner, modification time and permissions on
             directories afterwards. `path' specifies a different directory
             to extract to. `members' is optional and must be a subset of the
             list returned by getmembers(). If `numeric_owner` is True, only
             the numbers for user/group names are used and not the names.
        
extractfile(self, 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. For all other
             existing members, None is returned. If `member' does not appear
             in the archive, KeyError is raised.
        
getmember(self, name)

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

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

  Return the members of the archive as a list of their names. It has
             the same order as the list returned by getmembers().
        
gettarinfo(self, name=None, arcname=None, fileobj=None)

  Create a TarInfo object from the result of os.stat or equivalent
             on an existing file. The file is either named by `name', or
             specified as a file object `fileobj' with a file descriptor. If
             given, `arcname' specifies an alternative name for the file in the
             archive, otherwise, the name is taken from the 'name' attribute of
             'fileobj', or the 'name' argument. The name should be a text
             string.
        
gzopen(name, mode='r', fileobj=None, compresslevel=9, **kwargs)

  Open gzip compressed tar archive name for reading or writing.
             Appending is not allowed.
        
list(self, verbose=True, *, members=None)

  Print a table of contents to sys.stdout. If `verbose' is False, only
             the names of the members are printed. If it is True, an `ls -l'-like
             output is produced. `members' is optional and must be a subset of the
             list returned by getmembers().
        
makedev(self, tarinfo, targetpath)

  Make a character or block device called targetpath.
        
makedir(self, tarinfo, targetpath)

  Make a directory called targetpath.
        
makefifo(self, tarinfo, targetpath)

  Make a fifo called targetpath.
        
makefile(self, tarinfo, targetpath)

  Make a file called targetpath.
        
makelink(self, tarinfo, targetpath)

  Make a (symbolic) link called targetpath. If it cannot be created
            (platform limitation), we try to make a copy of the referenced file
            instead of a link.
        
makeunknown(self, tarinfo, targetpath)

  Make a file from a TarInfo object with an unknown type
             at targetpath.
        
next(self)

  Return the next member of the archive as a TarInfo object, when
             TarFile is opened for reading. Return None if there is no more
             available.
        
open(name=None, mode='r', fileobj=None, bufsize=10240, **kwargs)

  Open a tar archive for reading, writing or appending. Return
             an appropriate TarFile class.

             mode:
             'r' or 'r:*' open for reading with transparent compression
             'r:'         open for reading exclusively uncompressed
             'r:gz'       open for reading with gzip compression
             'r:bz2'      open for reading with bzip2 compression
             'r:xz'       open for reading with lzma compression
             'a' or 'a:'  open for appending, creating the file if necessary
             'w' or 'w:'  open for writing without compression
             'w:gz'       open for writing with gzip compression
             'w:bz2'      open for writing with bzip2 compression
             'w:xz'       open for writing with lzma compression

             'x' or 'x:'  create a tarfile exclusively without compression, raise
                          an exception if the file is already created
             'x:gz'       create a gzip compressed tarfile, raise an exception
                          if the file is already created
             'x:bz2'      create a bzip2 compressed tarfile, raise an exception
                          if the file is already created
             'x:xz'       create an lzma compressed tarfile, raise an exception
                          if the file is already created

             'r|*'        open a stream of tar blocks with transparent compression
             'r|'         open an uncompressed stream of tar blocks for reading
             'r|gz'       open a gzip compressed stream of tar blocks
             'r|bz2'      open a bzip2 compressed stream of tar blocks
             'r|xz'       open an lzma compressed stream of tar blocks
             'w|'         open an uncompressed stream for writing
             'w|gz'       open a gzip compressed stream for writing
             'w|bz2'      open a bzip2 compressed stream for writing
             'w|xz'       open an lzma compressed stream for writing
        
taropen(name, mode='r', fileobj=None, **kwargs)

  Open uncompressed tar archive name for reading or writing.
        
utime(self, tarinfo, targetpath)

  Set modification time of targetpath according to tarinfo.
        
xzopen(name, mode='r', fileobj=None, preset=None, **kwargs)

  Open lzma compressed tar archive name for reading or writing.
             Appending is not allowed.
        
OPEN_METH = {'tar': 'taropen', 'gz': 'gzopen', 'bz2': 'bz2open', 'xz': 'xzopen'}
debug = 0
dereference = False
encoding = 'utf-8'
errorlevel = 1
errors = None
format = 2
ignore_zeros = False

TarInfo

Informational class which holds the details about an
       archive member given by a tar header block.
       TarInfo objects are returned by TarFile.getmember(),
       TarFile.getmembers() and TarFile.gettarinfo() and are
       usually created internally.
    
create_gnu_header(self, info, encoding, errors)

  Return the object as a GNU header block sequence.
        
create_pax_global_header(pax_headers)

  Return the object as a pax global header block sequence.
        
create_pax_header(self, info, encoding)

  Return the object as a ustar header block. If it cannot be
             represented this way, prepend a pax extended header sequence
             with supplement information.
        
create_ustar_header(self, info, encoding, errors)

  Return the object as a ustar header block.
        
frombuf(buf, encoding, errors)

  Construct a TarInfo object from a 512 byte bytes object.
        
fromtarfile(tarfile)

  Return the next TarInfo object from TarFile object
             tarfile.
        
get_info(self)

  Return the TarInfo's attributes as a dictionary.
        
isblk(self)

  Return True if it is a block device.
ischr(self)

  Return True if it is a character device.
isdev(self)

  Return True if it is one of character device, block device or FIFO.
isdir(self)

  Return True if it is a directory.
isfifo(self)

  Return True if it is a FIFO.
isfile(self)

  Return True if the Tarinfo object is a regular file.
islnk(self)

  Return True if it is a hard link.
isreg(self)

  Return True if the Tarinfo object is a regular file.
issparse(self)
issym(self)

  Return True if it is a symbolic link.
tobuf(self, format=2, encoding='utf-8', errors='surrogateescape')

  Return a tar header as a string of 512 byte blocks.
        
chksum = <member 'chksum' of 'TarInfo' objects>
devmajor = <member 'devmajor' of 'TarInfo' objects>
devminor = <member 'devminor' of 'TarInfo' objects>
gid = <member 'gid' of 'TarInfo' objects>
gname = <member 'gname' of 'TarInfo' objects>
linkname = <member 'linkname' of 'TarInfo' objects>
linkpath = <property object at 0x7f75e0a3ca90>
  In pax headers, "linkname" is called "linkpath".
mode = <member 'mode' of 'TarInfo' objects>
mtime = <member 'mtime' of 'TarInfo' objects>
name = <member 'name' of 'TarInfo' objects>
offset = <member 'offset' of 'TarInfo' objects>
offset_data = <member 'offset_data' of 'TarInfo' objects>
path = <property object at 0x7f75e0a3ca40>
  In pax headers, "name" is called "path".
pax_headers = <member 'pax_headers' of 'TarInfo' objects>
size = <member 'size' of 'TarInfo' objects>
sparse = <member 'sparse' of 'TarInfo' objects>
tarfile = <member 'tarfile' of 'TarInfo' objects>
type = <member 'type' of 'TarInfo' objects>
uid = <member 'uid' of 'TarInfo' objects>
uname = <member 'uname' of 'TarInfo' objects>

TruncatedHeaderError

Exception for truncated headers.
with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

Functions

bltn_open

open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)

  Open file and return a stream.  Raise OSError upon failure.

  file is either a text or byte string giving the name (and the path
  if the file isn't in the current working directory) of the file to
  be opened or an integer file descriptor of the file to be
  wrapped. (If a file descriptor is given, it is closed when the
  returned I/O object is closed, unless closefd is set to False.)

  mode is an optional string that specifies the mode in which the file
  is opened. It defaults to 'r' which means open for reading in text
  mode.  Other common values are 'w' for writing (truncating the file if
  it already exists), 'x' for creating and writing to a new file, and
  'a' for appending (which on some Unix systems, means that all writes
  append to the end of the file regardless of the current seek position).
  In text mode, if encoding is not specified the encoding used is platform
  dependent: locale.getpreferredencoding(False) is called to get the
  current locale encoding. (For reading and writing raw bytes use binary
  mode and leave encoding unspecified.) The available modes are:

  ========= ===============================================================
  Character Meaning
  --------- ---------------------------------------------------------------
  'r'       open for reading (default)
  'w'       open for writing, truncating the file first
  'x'       create a new file and open it for writing
  'a'       open for writing, appending to the end of the file if it exists
  'b'       binary mode
  't'       text mode (default)
  '+'       open a disk file for updating (reading and writing)
  'U'       universal newline mode (deprecated)
  ========= ===============================================================

  The default mode is 'rt' (open for reading text). For binary random
  access, the mode 'w+b' opens and truncates the file to 0 bytes, while
  'r+b' opens the file without truncation. The 'x' mode implies 'w' and
  raises an `FileExistsError` if the file already exists.

  Python distinguishes between files opened in binary and text modes,
  even when the underlying operating system doesn't. Files opened in
  binary mode (appending 'b' to the mode argument) return contents as
  bytes objects without any decoding. In text mode (the default, or when
  't' is appended to the mode argument), the contents of the file are
  returned as strings, the bytes having been first decoded using a
  platform-dependent encoding or using the specified encoding if given.

  'U' mode is deprecated and will raise an exception in future versions
  of Python.  It has no effect in Python 3.  Use newline to control
  universal newlines mode.

  buffering is an optional integer used to set the buffering policy.
  Pass 0 to switch buffering off (only allowed in binary mode), 1 to select
  line buffering (only usable in text mode), and an integer > 1 to indicate
  the size of a fixed-size chunk buffer.  When no buffering argument is
  given, the default buffering policy works as follows:

  * Binary files are buffered in fixed-size chunks; the size of the buffer
    is chosen using a heuristic trying to determine the underlying device's
    "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
    On many systems, the buffer will typically be 4096 or 8192 bytes long.

  * "Interactive" text files (files for which isatty() returns True)
    use line buffering.  Other text files use the policy described above
    for binary files.

  encoding is the name of the encoding used to decode or encode the
  file. This should only be used in text mode. The default encoding is
  platform dependent, but any encoding supported by Python can be
  passed.  See the codecs module for the list of supported encodings.

  errors is an optional string that specifies how encoding errors are to
  be handled---this argument should not be used in binary mode. Pass
  'strict' to raise a ValueError exception if there is an encoding error
  (the default of None has the same effect), or pass 'ignore' to ignore
  errors. (Note that ignoring encoding errors can lead to data loss.)
  See the documentation for codecs.register or run 'help(codecs.Codec)'
  for a list of the permitted encoding error strings.

  newline controls how universal newlines works (it only applies to text
  mode). It can be None, '', '\n', '\r', and '\r\n'.  It works as
  follows:

  * On input, if newline is None, universal newlines mode is
    enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
    these are translated into '\n' before being returned to the
    caller. If it is '', universal newline mode is enabled, but line
    endings are returned to the caller untranslated. If it has any of
    the other legal values, input lines are only terminated by the given
    string, and the line ending is returned to the caller untranslated.

  * On output, if newline is None, any '\n' characters written are
    translated to the system default line separator, os.linesep. If
    newline is '' or '\n', no translation takes place. If newline is any
    of the other legal values, any '\n' characters written are translated
    to the given string.

  If closefd is False, the underlying file descriptor will be kept open
  when the file is closed. This does not work when a file name is given
  and must be True in that case.

  A custom opener can be used by passing a callable as *opener*. The
  underlying file descriptor for the file object is then obtained by
  calling *opener* with (*file*, *flags*). *opener* must return an open
  file descriptor (passing os.open as *opener* results in functionality
  similar to passing None).

  open() returns a file object whose type depends on the mode, and
  through which the standard file operations such as reading and writing
  are performed. When open() is used to open a file in a text mode ('w',
  'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open
  a file in a binary mode, the returned class varies: in read binary
  mode, it returns a BufferedReader; in write binary and append binary
  modes, it returns a BufferedWriter, and in read/write mode, it returns
  a BufferedRandom.

  It is also possible to use a string or bytearray as a file for both
  reading and writing. For strings StringIO can be used like a file
  opened in a text mode, and for bytes a BytesIO can be used like a file
  opened in a binary mode.

calc_chksums

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. According to the GNU tar sources,
         some tars (Sun and NeXT) calculate chksum with signed char,
         which will be different if there are chars in the buffer with
         the high bit set. So we calculate two checksums, unsigned and
         signed.
    

copyfileobj

copyfileobj(src, dst, length=None, exception=<class 'OSError'>, bufsize=None)

  Copy length bytes from fileobj src to fileobj dst.
         If length is None, copy the entire content.
    

is_tarfile

is_tarfile(name)

  Return True if name points to a tar archive that we
         are able to handle, else return False.

         'name' should be a string, file, or file-like object.
    

itn

itn(n, digits=8, format=2)

  Convert a python number to a number field.
    

main

main()

nti

nti(s)

  Convert a number field to a python number.
    

nts

nts(s, encoding, errors)

  Convert a null-terminated bytes object to a string.
    

open

open(name=None, mode='r', fileobj=None, bufsize=10240, **kwargs)

  Open a tar archive for reading, writing or appending. Return
             an appropriate TarFile class.

             mode:
             'r' or 'r:*' open for reading with transparent compression
             'r:'         open for reading exclusively uncompressed
             'r:gz'       open for reading with gzip compression
             'r:bz2'      open for reading with bzip2 compression
             'r:xz'       open for reading with lzma compression
             'a' or 'a:'  open for appending, creating the file if necessary
             'w' or 'w:'  open for writing without compression
             'w:gz'       open for writing with gzip compression
             'w:bz2'      open for writing with bzip2 compression
             'w:xz'       open for writing with lzma compression

             'x' or 'x:'  create a tarfile exclusively without compression, raise
                          an exception if the file is already created
             'x:gz'       create a gzip compressed tarfile, raise an exception
                          if the file is already created
             'x:bz2'      create a bzip2 compressed tarfile, raise an exception
                          if the file is already created
             'x:xz'       create an lzma compressed tarfile, raise an exception
                          if the file is already created

             'r|*'        open a stream of tar blocks with transparent compression
             'r|'         open an uncompressed stream of tar blocks for reading
             'r|gz'       open a gzip compressed stream of tar blocks
             'r|bz2'      open a bzip2 compressed stream of tar blocks
             'r|xz'       open an lzma compressed stream of tar blocks
             'w|'         open an uncompressed stream for writing
             'w|gz'       open a gzip compressed stream for writing
             'w|bz2'      open a bzip2 compressed stream for writing
             'w|xz'       open an lzma compressed stream for writing
        

stn

stn(s, length, encoding, errors)

  Convert a string to a null-terminated bytes object.
    

Other members

AREGTYPE = b'\x00'
BLKTYPE = b'4'
BLOCKSIZE = 512
CHRTYPE = b'3'
CONTTYPE = b'7'
DEFAULT_FORMAT = 2
DIRTYPE = b'5'
ENCODING = 'utf-8'
FIFOTYPE = b'6'
GNUTYPE_LONGLINK = b'K'
GNUTYPE_LONGNAME = b'L'
GNUTYPE_SPARSE = b'S'
GNU_FORMAT = 1
GNU_MAGIC = b'ustar  \x00'
GNU_TYPES = (b'L', b'K', b'S')
LENGTH_LINK = 100
LENGTH_NAME = 100
LENGTH_PREFIX = 155
LNKTYPE = b'1'
NUL = b'\x00'
PAX_FIELDS = ('path', 'linkpath', 'size', 'mtime', 'uid', 'gid', 'uname', 'gname')
PAX_FORMAT = 2
PAX_NAME_FIELDS = {'linkpath', 'gname', 'path', 'uname'}
PAX_NUMBER_FIELDS = {'atime': <class 'float'>, 'ctime': <class 'float'>, 'mtime': <class 'float'>, 'uid': <class 'int'>, 'gid': <class 'int'>, 'size': <class 'int'>}
POSIX_MAGIC = b'ustar\x0000'
RECORDSIZE = 10240
REGTYPE = b'0'
REGULAR_TYPES = (b'0', b'\x00', b'7', b'S')
SOLARIS_XHDTYPE = b'X'
SUPPORTED_TYPES = (b'0', b'\x00', b'1', b'2', b'5', b'6', b'7', b'3', b'4', b'L', b'K', b'S')
SYMTYPE = b'2'
USTAR_FORMAT = 0
XGLTYPE = b'g'
XHDTYPE = b'x'
symlink_exception = (<class 'AttributeError'>, <class 'NotImplementedError'>, <class 'OSError'>)
version = '0.9.0'

Modules

copy

grp

io

os

pwd

re

shutil

stat

struct

sys

time