Skip to content

EntryWriter

Content stream for one scoped TAR entry.

The writer is valid until the entry's scope ends. A function that accepts an Io, such as compress.compress, can write the content during the scope.

Errors

Exception Condition
StateError The entry's scope has ended
ValueError A write would exceed the declared size; nothing of it is written

Example

entry.put "first"
entry.put b"second"

Inherits from: io.Io

Fields

writable @ Bool [get]

Whether the writer is still valid.

Methods

write *data -> Int

Writes raw string or binary bytes, given in pieces.

Parameters

NameTypeDescription
*data (Str | Bin) Bytes to write.

Returns

The number of bytes written, which is all of them.

Example

entry.write $header "\n"
entry.write b"\x00\x01"