ZipFile.ZipFileModule

A 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> write(f, "hello world!
");
julia> f = ZipFile.addfile(w, "julia.txt", method=ZipFile.Deflate);
julia> write(f, "Julia
"^5);
julia> close(w)
julia> for f in r.files
println("Filename: \$(f.name)")
end
julia> close(r)
Filename: hello.txt
hello world!
Filename: julia.txt
Julia
Julia
Julia
Julia
Julia
ZipFile.ReaderType

Reader(io::IO)
Reader(filename::AbstractString)

Read a ZIP file from io or the file named filename.

ZipFile.WriterType

Reader 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.addfileMethod
addfile(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.