class Zip64::File
- Zip64::File
- Reference
- Object
Overview
Provides random read access to zip file entries stores inside
a File
or an IO::Memory
.
Example
require "zip64"
Zip64::File.open("./file.zip") do |file|
# Iterate through all entries printing their filename and contents
file.entries.each do |entry|
p entry.filename
entry.open do |io|
p io.gets_to_end
end
end
# Random access to entries by filename is also provided
entry = file["some_file.txt"]
entry.open do |io|
p io.gets_to_end
end
end
Defined in:
zip64/file.crConstructors
-
.new(io : IO, sync_close : Bool = false)
Opens a
Zip64::File
for reading from the given io. -
.new(filename : Path | String)
Opens a
Zip64::File
for reading from the given filename.
Class Method Summary
-
.open(io : IO, sync_close = false, &)
Opens a
Zip64::File
for reading from the given io, yields it to the given block, and closes it at the end. -
.open(filename : Path | String, &)
Opens a
Zip64::File
for reading from the given filename, yields it to the given block, and closes it at the end.
Instance Method Summary
-
#[](filename : Path | String) : Entry
Returns the entry that has the given filename, or raises
KeyError
if no such entry exists. -
#[]?(filename : Path | String) : Entry | Nil
Returns the entry that has the given filename, or
nil
if no such entry exists. -
#close : Nil
Closes this zip file.
-
#closed? : Bool
Returns
true
if this zip file is closed. -
#comment : String
Returns the zip file comment.
-
#entries : Array(Entry)
Returns all entries inside this zip file.
Constructor Detail
Opens a Zip64::File
for reading from the given io.
Class Method Detail
Opens a Zip64::File
for reading from the given io, yields
it to the given block, and closes it at the end.
Opens a Zip64::File
for reading from the given filename, yields
it to the given block, and closes it at the end.
Instance Method Detail
Returns the entry that has the given filename, or
raises KeyError
if no such entry exists.
Returns the entry that has the given filename, or
nil
if no such entry exists.