class Zip::Archive

Overview

Input archive.

Use Zip.read() instead of instantiating this class directly.

Included Modules

Defined in:

Class Method Summary

Instance Method Summary

Class Method Detail

def self.new(io : Source) #

Create new Zip::Archive from input Zip::Source.

Use Zip.read() instead of calling this method directly.


Instance Method Detail

def [](path : String) : Entry #

Get Zip::Entry by path.

Example:

# get bar.txt and read it into memory io
io = MemoryIO.new
zip["bar.txt"].read(io)

def [](id : Int) : Entry #

Get Zip::Entry by number.

Example:

# read third entry from archive into memory io
io = MemoryIO.new
zip[2].read(io)

def []?(id : Int) : Entry | Nil #

Get Zip::Entry by number, or nil if it doesn't exist

Example:

# read third entry from archive into memory io
if e = zip[2]?
  io = MemoryIO.new
  e.read(io)
end

def []?(path : String) : Entry | Nil #

Return Zip::Entry from path, or nil if it doesn't exist.

Example:

# read bar.txt into memory io if it exists
if e = zip["bar.txt"]?
  io = MemoryIO.new
  e.read(io)
end

def comment : String #

def each(*args, **options, &block) #

def each(*args, **options) #

def entries : Array(Zip::Entry) #

def size(*args, **options, &block) #

def size(*args, **options) #