Writer
Sequential writer for a new TAR archive.
Fields
Methods
create_dir path …
Creates a directory entry.
Parameters
| Name | Type | Description |
|---|---|---|
path |
(Str | fs.Path) |
Entry path. |
:mode? |
Int |
Permission bits. Defaults to 0o755. |
:uid? |
Int |
Owner ID. Defaults to 0. |
:gid? |
Int |
Group ID. Defaults to 0. |
:mtime? |
time.DateTime |
Modification time. Defaults to the Unix epoch. |
:owner_name? |
Str |
Owner name. |
:group_name? |
Str |
Group name. |
Example
entry[R] path func … -> R
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 | fs.Path) |
Entry path. |
:size? |
Int |
Exact content size. Required. |
:mode? |
Int |
Permission bits. Defaults to 0o644. |
:uid? |
Int |
Owner ID. Defaults to 0. |
:gid? |
Int |
Group ID. Defaults to 0. |
:mtime? |
time.DateTime |
Modification time. Defaults to the Unix epoch. |
:owner_name? |
Str |
Owner name. |
:group_name? |
Str |
Group name. |
func |
((EntryWriter) -> R) |
Entry writer scope, called with an
EntryWriter. |
Errors
| Exception | Condition |
|---|---|
ConcurrencyError |
Another entry is created while an entry scope is active |
ValueError |
The number of bytes written differs from the declared size |
Example
hard_link target path …
Creates a hard-link entry pointing to target.
Argument order matches fs.hard_link.
Parameters
| Name | Type | Description |
|---|---|---|
target |
(Str | fs.Path) |
Path the hard link points to. |
path |
(Str | fs.Path) |
Entry path. |
:mode? |
Int |
Permission bits. Defaults to 0o644. |
:uid? |
Int |
Owner ID. Defaults to 0. |
:gid? |
Int |
Group ID. Defaults to 0. |
:mtime? |
time.DateTime |
Modification time. Defaults to the Unix epoch. |
:owner_name? |
Str |
Owner name. |
:group_name? |
Str |
Group name. |
Example
symlink target path …
Creates a symbolic link entry pointing to target.
Argument order matches
fs.symlink_file.
Parameters
| Name | Type | Description |
|---|---|---|
target |
(Str | fs.Path) |
Path the symlink points to. |
path |
(Str | fs.Path) |
Entry path. |
:mode? |
Int |
Permission bits. Defaults to 0o777. |
:uid? |
Int |
Owner ID. Defaults to 0. |
:gid? |
Int |
Group ID. Defaults to 0. |
:mtime? |
time.DateTime |
Modification time. Defaults to the Unix epoch. |
:owner_name? |
Str |
Owner name. |
:group_name? |
Str |
Group name. |