The zip-archive library provides functions for creating, modifying,
and extracting files from zip archives.
Certain simplifying assumptions are made about the zip archives: in
particular, there is no support for strong encryption, zip files that span
multiple disks, ZIP64, OS-specific file attributes, or compression
methods other than Deflate. However, the library should be able to
read the most common zip archives, and the archives it produces should
be readable by all standard unzip programs.
One known limitation: when parsing an archive whose local file
headers defer sizes to a data descriptor (general purpose bit 3)
and whose entries are stored without compression, the end of the
entry data can only be found by scanning for the optional data
descriptor signature 0x08074b50. Parsing such an archive can
therefore fail (or truncate an entry) if that byte sequence occurs
within the stored data itself. Archives of this kind are rare;
deflated entries with data descriptors are not affected.
As an example of the use of the library, a standalone zip archiver
and extractor, Zip.hs, is provided in the source distribution.
Preserve symbolic links as such. This option is ignored on Windows. WARNING: symbolic link targets are not validated on extraction, so they may be absolute or point outside of the destination directory; do not use this option when extracting untrusted archives.
Instances3Eq, Read, Show
EqZipOptionDefined in zip-archive-0.5 · Codec.Archive.Zip
ReadZipOptionDefined in zip-archive-0.5 · Codec.Archive.Zip
ShowZipOptionDefined in zip-archive-0.5 · Codec.Archive.Zip
Like toArchive, but returns an Either value instead of raising an
error if the archive cannot be decoded. NOTE: This function only
works properly when the library is compiled against binary >= 0.7.
With earlier versions, it will always return a Right value,
raising an error if parsing fails.
Writes an Archive structure to a raw zip archive (in a lazy bytestring).
Throws a pure Zip64NotSupported exception if the archive has 65535
or more entries or is 4GB or larger, since this would require the
(unsupported) ZIP64 extension.
Create an Entry with specified file path, modification time, and contents.
Throws a pure Zip64NotSupported exception if the contents are too
large to be represented without the (unsupported) ZIP64 extension.
Write an Entry representing a symbolic link to a file.
If the Entry does not represent a symbolic link or
the options do not contain OptPreserveSymbolicLinks, this
function behaves like writeEntry.
Note that the symbolic link target is written as is; it may be
absolute or point outside of the extraction directory. Do not
extract untrusted archives with OptPreserveSymbolicLinks.
Add the specified files to an Archive. If OptRecursive is specified,
recursively add files contained in directories. if OptPreserveSymbolicLinks
is specified, don't recurse into it. If OptVerbose is specified,
print messages to stderr.
Extract all files from an Archive, creating directories
as needed. If OptVerbose is specified, print messages to stderr.
Note that the last-modified time is set correctly only in POSIX,
not in Windows.
This function fails if encrypted entries are present.
See the warning on OptPreserveSymbolicLinks before using it
with untrusted archives.