unzip v0.4.0 Unzip View Source
Module to get files out of a zip. Works with local and remote files
Overview
Unzip tries to solve problem of accessing files from a zip which is not local (Aws S3, sftp etc). It does this by simply separating file system and zip implementation. Anything which implements Unzip.FileAccess
can be used to get zip contents. Unzip relies on the ability to seek and read of the file, This is due to the nature of zip file. Files from the zip are read on demand.
Usage
# Unzip.LocalFile implements Unzip.FileAccess
zip_file = Unzip.LocalFile.open("foo/bar.zip")
# `new` reads list of files by reading central directory found at the end of the zip
{:ok, unzip} = Unzip.new(zip_file)
# presents already read files metadata
file_entries = Unzip.list_entries(unzip)
# returns decompressed file stream
stream = Unzip.file_stream!(unzip, "baz.png")
Supports STORED and DEFLATE compression methods. Does not support zip64 specification yet
Link to this section Summary
Functions
Returns decompressed file entry from the zip as a stream. file_name
must be complete file path. File is read in the chunks of 65k
Returns list of files metadata. This does not make pread
call as metadata is already by new/1
.
Creates Unzip struct by reading central directory found at the end of the zip (reads entries in the file)
Link to this section Functions
Returns decompressed file entry from the zip as a stream. file_name
must be complete file path. File is read in the chunks of 65k
Returns list of files metadata. This does not make pread
call as metadata is already by new/1
.
See Unzip.Entry
for metadata fields
Creates Unzip struct by reading central directory found at the end of the zip (reads entries in the file)