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
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
Deflate compression method
Compression method that does no compression
Reader represents a ZIP file open for reading.
Read a ZIP file from io or the file named filename.
Reader represents a ZIP file open for writing.
Create a new ZIP file that will be written to io or the file named filename.
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.
create underlying Zlib reader if doesn't exist
Load a little endian
UInt32 from a
b starting from index
advance io position state and crc32 checksum, checking it at eof