Writer
Adds entries sequentially to a new TAR archive.
Fields
compression
Selected compression as :NONE:, :GZIP:, or :ZSTD:.
Methods
entry path :size ... func
Adds one regular-file entry and calls func with a scoped
EntryWriter. For directory, symlink, or hard-link
entries, use
create_dir,
symlink, or
hard_link
instead — none of them carry content, so none of them have any use for a write
handle.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
Str|UnixPath |
Entry path |
size |
Int |
Exact content size |
mode |
Int? |
Permission bits; default 0o644 |
uid |
Int? |
Owner ID; default 0 |
gid |
Int? |
Group ID; default 0 |
mtime |
DateTime? |
Modification time; default Unix epoch |
user_name |
Str? |
Owner name |
group_name |
Str? |
Group name |
func |
callable | Entry writer scope |
Returns: the result of func.
Errors:
- Creating another entry while an entry scope is active raises a concurrency error.
- Writing fewer or more bytes than
sizefails and prevents further entries.
create_dir path :mode? :uid? :gid? :mtime? :user_name? :group_name?
Creates a directory entry.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
Str|UnixPath |
Entry path |
mode |
Int? |
Permission bits; default 0o755 |
uid |
Int? |
Owner ID; default 0 |
gid |
Int? |
Group ID; default 0 |
mtime |
DateTime? |
Modification time; default Unix epoch |
user_name |
Str? |
Owner name |
group_name |
Str? |
Group name |
symlink target path :mode? :uid? :gid? :mtime? :user_name? :group_name?
Creates a symbolic link entry pointing to target. Argument order matches
fs.symlink_file.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
Str|UnixPath |
Path the symlink points to |
path |
Str|UnixPath |
Entry path |
mode |
Int? |
Permission bits; default 0o777 |
uid |
Int? |
Owner ID; default 0 |
gid |
Int? |
Group ID; default 0 |
mtime |
DateTime? |
Modification time; default Unix epoch |
user_name |
Str? |
Owner name |
group_name |
Str? |
Group name |
hard_link target path :mode? :uid? :gid? :mtime? :user_name? :group_name?
Creates a hard-link entry pointing to target. Argument order matches
fs.hard_link.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
Str|UnixPath |
Path the hard link points to |
path |
Str|UnixPath |
Entry path |
mode |
Int? |
Permission bits; default 0o644 |
uid |
Int? |
Owner ID; default 0 |
gid |
Int? |
Group ID; default 0 |
mtime |
DateTime? |
Modification time; default Unix epoch |
user_name |
Str? |
Owner name |
group_name |
Str? |
Group name |