tarfile¶
Read and write tar archive files.
Constants¶
| Name | Type | Description |
|---|---|---|
REGTYPE |
int |
|
DIRTYPE |
int |
|
SYMTYPE |
int |
|
LNKTYPE |
int |
Functions¶
tarfile.open(name: str, mode: str = "r") -> TarFile¶
tarfile.is_tarfile(name: str) -> bool¶
TarError¶
Base exception for tarfile errors.
Equivalent to Python's tarfile.TarError.
ReadError¶
Raised when a tar archive cannot be read.
CompressionError¶
Raised for unsupported compression methods.
ExtractError¶
Raised when extraction fails.
TarFile¶
Tar archive for reading or writing.
Equivalent to Python's tarfile.TarFile.
Properties¶
| Name | Type | Description |
|---|---|---|
name |
str |
getnames() -> list[str]¶
getmembers() -> list[TarInfo]¶
getmember(name: str) -> TarInfo¶
extractfile(name: str) -> bytes | None¶
extractall(path: str | None = None, members: list[TarInfo] | None = None)¶
extract(name: str, path: str | None = None)¶
add(name: str, arcname: str | None = None, recursive: bool = True)¶
addfile(tarinfo: TarInfo, fileobj: Stream | None = None)¶
close()¶
__str__() -> str¶
repr() uses the same method.
TarInfo¶
Metadata about a tar archive member.
Equivalent to Python's tarfile.TarInfo.
Properties¶
| Name | Type | Description |
|---|---|---|
name |
str |
|
size |
int64 |
|
mtime |
float |
|
mode |
int |
|
type |
int |
|
linkname |
str |
|
uid |
int |
|
gid |
int |
|
uname |
str |
|
gname |
str |
isfile() -> bool¶
isdir() -> bool¶
issym() -> bool¶
islnk() -> bool¶
__str__() -> str¶
repr() uses the same method.