-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | The zip-archive library provides functions for creating, modifying,
--   and extracting files from zip archives. The zip archive format is
--   documented in
--   <a>http://www.pkware.com/documents/casestudies/APPNOTE.TXT</a>.
--   
--   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.
--   
--   Archives are built and extracted in memory, so manipulating large zip
--   files will consume a lot of memory. If you work with large zip files
--   or need features not supported by this library, a better choice may be
--   <a>zip</a>, which uses a memory-efficient streaming approach. However,
--   zip can only read and write archives inside instances of MonadIO, so
--   zip-archive is a better choice if you want to manipulate zip archives
--   in "pure" contexts.
--   
--   As an example of the use of the library, a standalone zip archiver and
--   extractor is provided in the source distribution.
@package zip-archive
@version 0.5


-- | 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
--   <tt>0x08074b50</tt>. 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
--   <a>http://www.pkware.com/documents/casestudies/APPNOTE.TXT</a>
module Codec.Archive.Zip

-- | Structured representation of a zip archive, including directory
--   information and contents (in lazy bytestrings).
data Archive
Archive :: [Entry] -> Maybe ByteString -> !ByteString -> Archive

-- | Files in zip archive
[zEntries] :: Archive -> [Entry]

-- | Digital signature
[zSignature] :: Archive -> Maybe ByteString

-- | Comment for whole zip archive
[zComment] :: Archive -> !ByteString

-- | Representation of an archived file, including content and metadata.
data Entry
Entry :: FilePath -> !CompressionMethod -> !EncryptionMethod -> !Integer -> !Word32 -> !Word32 -> !Word32 -> !ByteString -> !ByteString -> !Word16 -> !Word16 -> !Word32 -> !ByteString -> Entry

-- | Relative path, using <a>/</a> as separator
[eRelativePath] :: Entry -> FilePath

-- | Compression method
[eCompressionMethod] :: Entry -> !CompressionMethod

-- | Encryption method
[eEncryptionMethod] :: Entry -> !EncryptionMethod

-- | Modification time (seconds since unix epoch, shifted by the local time
--   zone offset: MSDOS timestamps in zip archives are conventionally local
--   time)
[eLastModified] :: Entry -> !Integer

-- | CRC32 checksum
[eCRC32] :: Entry -> !Word32

-- | Compressed size in bytes
[eCompressedSize] :: Entry -> !Word32

-- | Uncompressed size in bytes
[eUncompressedSize] :: Entry -> !Word32

-- | Extra field - unused by this library
[eExtraField] :: Entry -> !ByteString

-- | File comment - unused by this library
[eFileComment] :: Entry -> !ByteString

-- | Version made by field
[eVersionMadeBy] :: Entry -> !Word16

-- | Internal file attributes - unused by this library
[eInternalFileAttributes] :: Entry -> !Word16

-- | External file attributes (system-dependent)
[eExternalFileAttributes] :: Entry -> !Word32

-- | Compressed contents of file
[eCompressedData] :: Entry -> !ByteString

-- | Compression methods.
data CompressionMethod
Deflate :: CompressionMethod
NoCompression :: CompressionMethod
data EncryptionMethod

-- | Entry is not encrypted
NoEncryption :: EncryptionMethod

-- | Entry is encrypted with the traditional PKWARE encryption
PKWAREEncryption :: !Word8 -> EncryptionMethod

-- | Options for <a>addFilesToArchive</a> and
--   <a>extractFilesFromArchive</a>.
data ZipOption

-- | Recurse into directories when adding files
OptRecursive :: ZipOption

-- | Print information to stderr
OptVerbose :: ZipOption

-- | Directory in which to extract
OptDestination :: FilePath -> ZipOption

-- | Where to place file when adding files and whether to append current
--   path
OptLocation :: FilePath -> !Bool -> ZipOption

-- | 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.
OptPreserveSymbolicLinks :: ZipOption
data ZipException
CRC32Mismatch :: FilePath -> ZipException
UnsafePath :: FilePath -> ZipException
CannotWriteEncryptedEntry :: FilePath -> ZipException

-- | Data too large for the original zip format (which this library is
--   limited to); the ZIP64 extension would be required
Zip64NotSupported :: String -> ZipException

-- | A zip archive with no contents.
emptyArchive :: Archive

-- | Reads an <a>Archive</a> structure from a raw zip archive (in a lazy
--   bytestring).
toArchive :: ByteString -> Archive

-- | Like <a>toArchive</a>, but returns an <a>Either</a> 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 &gt;=
--   0.7. With earlier versions, it will always return a Right value,
--   raising an error if parsing fails.
toArchiveOrFail :: ByteString -> Either String Archive

-- | Writes an <a>Archive</a> structure to a raw zip archive (in a lazy
--   bytestring). Throws a pure <a>Zip64NotSupported</a> exception if the
--   archive has 65535 or more entries or is 4GB or larger, since this
--   would require the (unsupported) ZIP64 extension.
fromArchive :: Archive -> ByteString

-- | Returns a list of files in a zip archive.
filesInArchive :: Archive -> [FilePath]

-- | Adds an entry to a zip archive, or updates an existing entry.
addEntryToArchive :: Entry -> Archive -> Archive

-- | Deletes an entry from a zip archive.
deleteEntryFromArchive :: FilePath -> Archive -> Archive

-- | Returns Just the zip entry with the specified path, or Nothing.
findEntryByPath :: FilePath -> Archive -> Maybe Entry

-- | Returns uncompressed contents of zip entry.
fromEntry :: Entry -> ByteString

-- | Returns decrypted and uncompressed contents of zip entry.
fromEncryptedEntry :: String -> Entry -> Maybe ByteString

-- | Check if an <a>Entry</a> is encrypted
isEncryptedEntry :: Entry -> Bool

-- | Create an <a>Entry</a> with specified file path, modification time,
--   and contents. Throws a pure <a>Zip64NotSupported</a> exception if the
--   contents are too large to be represented without the (unsupported)
--   ZIP64 extension.
toEntry :: FilePath -> Integer -> ByteString -> Entry

-- | Check if an <a>Entry</a> represents a symbolic link
isEntrySymbolicLink :: Entry -> Bool

-- | Get the target of a <a>Entry</a> representing a symbolic link. This
--   might fail if the <a>Entry</a> does not represent a symbolic link
symbolicLinkEntryTarget :: Entry -> Maybe FilePath

-- | Get the <a>eExternalFileAttributes</a> of an <a>Entry</a> as a
--   <a>CMode</a> a.k.a. <tt>FileMode</tt>
entryCMode :: Entry -> CMode

-- | Generates a <a>Entry</a> from a file or directory.
readEntry :: [ZipOption] -> FilePath -> IO Entry

-- | Writes contents of an <a>Entry</a> to a file. Throws a
--   <a>CRC32Mismatch</a> exception if the CRC32 checksum for the entry
--   does not match the uncompressed data.
writeEntry :: [ZipOption] -> Entry -> IO ()

-- | Write an <a>Entry</a> representing a symbolic link to a file. If the
--   <a>Entry</a> does not represent a symbolic link or the options do not
--   contain <a>OptPreserveSymbolicLinks</a>, this function behaves like
--   <a>writeEntry</a>.
--   
--   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 <a>OptPreserveSymbolicLinks</a>.
writeSymbolicLinkEntry :: [ZipOption] -> Entry -> IO ()

-- | Add the specified files to an <a>Archive</a>. If <a>OptRecursive</a>
--   is specified, recursively add files contained in directories. if
--   <a>OptPreserveSymbolicLinks</a> is specified, don't recurse into it.
--   If <a>OptVerbose</a> is specified, print messages to stderr.
addFilesToArchive :: [ZipOption] -> Archive -> [FilePath] -> IO Archive

-- | Extract all files from an <a>Archive</a>, creating directories as
--   needed. If <a>OptVerbose</a> 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 <a>OptPreserveSymbolicLinks</a> before using it with
--   untrusted archives.
extractFilesFromArchive :: [ZipOption] -> Archive -> IO ()
instance Data.Binary.Class.Binary Codec.Archive.Zip.Archive
instance GHC.Internal.Data.Data.Data Codec.Archive.Zip.ZipException
instance GHC.Classes.Eq Codec.Archive.Zip.CompressionMethod
instance GHC.Classes.Eq Codec.Archive.Zip.EncryptionMethod
instance GHC.Classes.Eq Codec.Archive.Zip.Entry
instance GHC.Classes.Eq Codec.Archive.Zip.MSDOSDateTime
instance GHC.Classes.Eq Codec.Archive.Zip.PKWAREVerificationType
instance GHC.Classes.Eq Codec.Archive.Zip.ZipException
instance GHC.Classes.Eq Codec.Archive.Zip.ZipOption
instance GHC.Internal.Exception.Type.Exception Codec.Archive.Zip.ZipException
instance GHC.Internal.Read.Read Codec.Archive.Zip.Archive
instance GHC.Internal.Read.Read Codec.Archive.Zip.CompressionMethod
instance GHC.Internal.Read.Read Codec.Archive.Zip.EncryptionMethod
instance GHC.Internal.Read.Read Codec.Archive.Zip.Entry
instance GHC.Internal.Read.Read Codec.Archive.Zip.MSDOSDateTime
instance GHC.Internal.Read.Read Codec.Archive.Zip.PKWAREVerificationType
instance GHC.Internal.Read.Read Codec.Archive.Zip.ZipOption
instance GHC.Internal.Show.Show Codec.Archive.Zip.Archive
instance GHC.Internal.Show.Show Codec.Archive.Zip.CompressionMethod
instance GHC.Internal.Show.Show Codec.Archive.Zip.EncryptionMethod
instance GHC.Internal.Show.Show Codec.Archive.Zip.Entry
instance GHC.Internal.Show.Show Codec.Archive.Zip.MSDOSDateTime
instance GHC.Internal.Show.Show Codec.Archive.Zip.PKWAREVerificationType
instance GHC.Internal.Show.Show Codec.Archive.Zip.ZipException
instance GHC.Internal.Show.Show Codec.Archive.Zip.ZipOption
