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 @ Str [get]

Entry comment.

compressed_size @ Int [get]

Compressed size in bytes.

compression @ (:STORED: | :DEFLATE: | :ZSTD: | :UNKNOWN:) [get]

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

crc32 @ Int [get]

CRC-32 checksum of the uncompressed data.

last_modified @ (time.DateTime | nil) [get]

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

mode @ (Int | nil) [get]

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

name @ fs.unix.Path [get]

Entry name as an fs.unix.Path.

size @ Int [get]

Uncompressed size in bytes.

type @ fs.FileType [get]

Entry type.

Methods

open() -> File overload 1 of 2

Opens the entry for reading.

Errors

ConcurrencyError if another file is already open in the archive.

open[R] block -> R overload 2 of 2

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

ConcurrencyError if another file is already open in the archive.

Example

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