ZipFile.ZipFile
— ModuleA Julia package for reading/writing ZIP archive files
This package provides support for reading and writing ZIP archives in Julia. Install it via the Julia package manager using $Pkg.add("ZipFile")$.
The ZIP file format is described in http://www.pkware.com/documents/casestudies/APPNOTE.TXT
Example
The example below writes a new ZIP file and then reads back the contents.
julia> using ZipFile
julia> w = ZipFile.Writer("/tmp/example.zip");
julia> f = ZipFile.addfile(w, "hello.txt");
julia> write(f, "hello world!
");
julia> f = ZipFile.addfile(w, "julia.txt", method=ZipFile.Deflate);
julia> write(f, "Julia
"^5);
julia> close(w)
julia> r = ZipFile.Reader("/tmp/example.zip");
julia> for f in r.files
println("Filename: $(f.name)")
write(stdout, read(f, String));
end
julia> close(r)
Filename: hello.txt
hello world!
Filename: julia.txt
Julia
Julia
Julia
Julia
Julia
ZipFile.Deflate
— ConstantDeflate compression method
ZipFile.Store
— ConstantCompression method that does no compression
ZipFile.Reader
— TypeReader represents a ZIP file open for reading.
Reader(io::IO)
Reader(filename::AbstractString)
Read a ZIP file from io or the file named filename.
ZipFile.Writer
— TypeReader represents a ZIP file open for writing.
Writer(io::IO)
Writer(filename::AbstractString)
Create a new ZIP file that will be written to io or the file named filename.
ZipFile.addfile
— Methodaddfile(w::Writer, name::AbstractString; method::Integer=Store, mtime::Float64=-1.0)
Add a new file named name into the ZIP file writer w, and return the WritableFile for the new file. We don't allow concurrrent writes, thus the file previously added using this function will be closed.
Method specifies the compression method that will be used (Store for uncompressed or Deflate for compressed).
Mtime is the modification time of the file.
ZipFile.ensure_zio!
— Methodcreate underlying Zlib reader if doesn't exist
ZipFile.getindex_u32le
— MethodLoad a little endian UInt32
from a UInt8
vector b
starting from index i
ZipFile.update_reader!
— Methodadvance io position state and crc32 checksum, checking it at eof