HORIZON HASKELLDocslts/ghc-9.14.x6d5fdfd2026-10-12Search packagesCtrl K
Theme: |

GHC 9.14.1 · lts/ghc-9.14.x · 6d5fdfd · 2026-10-12

Modulezip-archive-0.5Haskell2010

Codec.Archive.Zip

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.

For more information on the format of zip archives, consult http://www.pkware.com/documents/casestudies/APPNOTE.TXT

Contents
  1. Data structures
  2. Pure functions for working with zip archives
  3. IO functions for working with zip archives
Synopsis
  • Packagezip-archive-0.5
  • Exports26
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceZip.hs

Data structures

datadata Archive

Structured representation of a zip archive, including directory information and contents (in lazy bytestrings).

Constructors

Instances3Read, Show, Binary
  • Read ArchiveDefined in zip-archive-0.5 · Codec.Archive.Zip
  • Show ArchiveDefined in zip-archive-0.5 · Codec.Archive.Zip
  • Binary ArchiveDefined in zip-archive-0.5 · Codec.Archive.Zip
datadata Entry

Representation of an archived file, including content and metadata.

Constructors

Instances3Eq, Read, Show
  • Eq EntryDefined in zip-archive-0.5 · Codec.Archive.Zip
  • Read EntryDefined in zip-archive-0.5 · Codec.Archive.Zip
  • Show EntryDefined in zip-archive-0.5 · Codec.Archive.Zip
datadata ZipOption

Constructors

  • OptRecursive

    Recurse into directories when adding files

  • OptVerbose

    Print information to stderr

  • OptDestination FilePath

    Directory in which to extract

  • OptLocation FilePath !Bool

    Where to place file when adding files and whether to append current path

Instances3Eq, Read, Show
datadata ZipException
#

Constructors

Instances4Eq, Data, Show, Exception

Pure functions for working with zip archives

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.

valuetoEntry
  1. :: FilePath

    File path for entry

  2. -> Integer

    Modification time for entry (seconds since unix epoch)

  3. -> ByteString

    Contents of entry

  4. -> Entry

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.

IO functions for working with zip archives