Skip to content

Entry

A single archive entry's metadata, with a method to open it for reading.

Entries are only available for archives opened in read mode, via Archive.entries.

Fields

comment

Entry comment.

compressed_size

Compressed size in bytes.

compression

Compression method as :STORED:, :DEFLATE:, :ZSTD:, or :UNKNOWN:.

crc32

CRC-32 checksum of the uncompressed data.

last_modified

Last modification time as DateTime, or nil when the stored timestamp cannot be represented.

mode

Unix permission bits, or nil when the archive does not provide Unix metadata.

name

Entry name as an fs.unix.Path.

size

Uncompressed size in bytes.

type

Entry type as :FILE:, :DIR:, :SYMLINK:, :FIFO:, :CHAR_DEVICE:, :BLOCK_DEVICE:, or :UNKNOWN:.

Methods

open() -> File

Opens the entry for reading.

Errors

Raises a concurrency error if another file is already open in the archive.

open[R] block -> R

Opens the entry for reading and calls block with it. The file is closed when block returns.

Parameters

NameTypeDescription
block ((File) -> R) Called with the File.

Errors

Raises a concurrency error if another file is already open in the archive.

Example

for entry = archive.entries
  entry.open do |file|
    echo (str (file.read entry.size))