← index

[Archive]Tar

inherits Object · mixes in Iterate · defined at core/15-tar.qn:51

The streaming reader. each: (and the whole Iterate vocabulary over it) consumes the stream — one pass, in archive order.

var tar = [Archive]Tar.over:(([IO]File.open:'backup.tar').byteStream)
tar.each:{ |e| ('%1  %2' % #( e.size e.name )).print }

Class methods

over:

A reader over a ByteStream — a file's, a socket's, or a gunzip-wrapped one for .tar.gz.

core/15-tar.qn:57

writeTo:

A writer onto a ByteStream — [IO]File.create:'s, a socket's, or a gzip-wrapped one for .tar.gz. See [Archive]TarWriter.

core/15-tar.qn:61

Instance methods

content:

Read exactly size content bytes plus the block padding.

core/15-tar.qn:184

contentFor:

The current entry's content (guarded: current entry only, read once).

core/15-tar.qn:174

each:

Yield each remaining entry in order; answers self. One pass — the Iterate vocabulary (select:, collect:, detect:, …) rides on this and consumes the stream the same way.

core/15-tar.qn:134

extractTo:

Extract every remaining FILE and DIRECTORY under dir (symlinks and specials are skipped). Member paths are normalized and confined: an absolute path or one escaping dir (../…) throws a ValueError — an archive must never write outside its target.

core/15-tar.qn:146

init

Internal.

core/15-tar.qn:65

mkdirs:

mkdir -p: create each missing component (Folder.create: is idempotent).

core/15-tar.qn:280

next

The next entry, or nil at the end-of-archive marker. Skips the previous entry's unread content first.

core/15-tar.qn:74

octalIn: from: to:

An octal field: digits accumulate, spaces/NULs (the traditional padding) are skipped.

core/15-tar.qn:226

paxPath:

The path= value from a pax extended header: records are '<len> <key>=<value>\n' with len counting the whole record.

core/15-tar.qn:260

skipCurrent

Skip the current entry's unread content, chunked — a passed-over entry may be huge, and skipping must not materialize it.

core/15-tar.qn:193

stringIn: from: to:

A NUL-terminated text field.

core/15-tar.qn:238

typeSymbol:

core/15-tar.qn:251

ustarName:

The ustar split name: prefix[345..500] + '/' + name[0..100].

core/15-tar.qn:245

verify:

The header checksum: every byte summed with the checksum field itself read as spaces. A mismatch means a corrupt or misaligned archive.

core/15-tar.qn:213

zero?:

core/15-tar.qn:206