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> 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.StoreConstant

Compression method that does no compression

ZipFile.ReaderType

Reader 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.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.