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


-- | ZIP archive streaming using conduits
--   
--   Process (extract and create) zip files as streams (e.g., over the
--   network), accessing contained files without having to write the zip
--   file to disk (unlike zip-conduit).
@package zip-stream
@version 0.2.2.0

module Codec.Archive.Zip.Conduit.Types

-- | Errors thrown during zip file processing
newtype ZipError
ZipError :: String -> ZipError

-- | Summary information at the end of a zip stream.
data ZipInfo
ZipInfo :: ByteString -> ZipInfo
[zipComment] :: ZipInfo -> ByteString

-- | (The beginning of) a single entry in a zip stream, which may be any
--   file or directory. As per zip file conventions, directory names should
--   end with a slash and have no data, but this library does not ensure
--   that.
data ZipEntry
ZipEntry :: Either Text ByteString -> LocalTime -> Maybe Word64 -> Maybe Word32 -> ZipEntry

-- | File name (in posix format, no leading slashes), either UTF-8 encoded
--   text or raw bytes (CP437), with a trailing slash for directories
[zipEntryName] :: ZipEntry -> Either Text ByteString

-- | Modification time
[zipEntryTime] :: ZipEntry -> LocalTime

-- | Size of file data (if known); checked on zipping and also used as hint
--   to enable zip64. Disables compression for known 0-byte files.
[zipEntrySize] :: ZipEntry -> Maybe Word64

-- | Host-dependent attributes, often MS-DOS directory attribute byte (only
--   supported when zipping)
[zipEntryExternalAttributes] :: ZipEntry -> Maybe Word32

-- | The data contents for a <a>ZipEntry</a>. For empty entries (e.g.,
--   directories), use <a>mempty</a>.
data ZipData (m :: Type -> Type)

-- | A known ByteString, which will be fully evaluated (not streamed)
ZipDataByteString :: ByteString -> ZipData (m :: Type -> Type)

-- | A byte stream producer, streamed (and compressed) directly into the
--   zip
ZipDataSource :: ConduitM () ByteString m () -> ZipData (m :: Type -> Type)

-- | Normalize any <a>ZipData</a> to a simple source
sourceZipData :: forall (m :: Type -> Type). Monad m => ZipData m -> ConduitM () ByteString m ()
instance GHC.Classes.Eq Codec.Archive.Zip.Conduit.Types.ZipEntry
instance GHC.Classes.Eq Codec.Archive.Zip.Conduit.Types.ZipInfo
instance GHC.Internal.Exception.Type.Exception Codec.Archive.Zip.Conduit.Types.ZipError
instance GHC.Internal.Data.String.IsString Codec.Archive.Zip.Conduit.Types.ZipError
instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Monoid (Codec.Archive.Zip.Conduit.Types.ZipData m)
instance GHC.Internal.Base.Monad m => GHC.Internal.Base.Semigroup (Codec.Archive.Zip.Conduit.Types.ZipData m)
instance GHC.Internal.Show.Show Codec.Archive.Zip.Conduit.Types.ZipEntry
instance GHC.Internal.Show.Show Codec.Archive.Zip.Conduit.Types.ZipError
instance GHC.Internal.Show.Show Codec.Archive.Zip.Conduit.Types.ZipInfo


-- | Stream the extraction of a zip file, e.g., as it's being downloaded.
module Codec.Archive.Zip.Conduit.UnZip

-- | Stream process a zip file, producing a sequence of entry headers and
--   data blocks. For example, this might produce: <tt>Left (ZipEntry
--   "directory/" ...), Left (ZipEntry "directory/file.txt" ...), Right
--   "hello w", Right "orld!\n", Left ...</tt> The final result is summary
--   information taken from the end of the zip file. No state is maintained
--   during processing, and, in particular, any information in the central
--   directory is discarded.
--   
--   This only supports a limited number of zip file features, including
--   deflate compression and zip64. It does not (ironically) support
--   uncompressed zip files that have been created as streams, where file
--   sizes are not known beforehand. Since it does not use the offset
--   information at the end of the file, it assumes all entries are packed
--   sequentially, which is usually the case. Any errors are thrown in the
--   underlying monad (as <a>ZipError</a>s or <a>ParseError</a>).
unZipStream :: forall (m :: Type -> Type). (MonadThrow m, PrimMonad m) => ConduitM ByteString (Either ZipEntry ByteString) m ZipInfo

-- | (The beginning of) a single entry in a zip stream, which may be any
--   file or directory. As per zip file conventions, directory names should
--   end with a slash and have no data, but this library does not ensure
--   that.
data ZipEntry
ZipEntry :: Either Text ByteString -> LocalTime -> Maybe Word64 -> Maybe Word32 -> ZipEntry

-- | File name (in posix format, no leading slashes), either UTF-8 encoded
--   text or raw bytes (CP437), with a trailing slash for directories
[zipEntryName] :: ZipEntry -> Either Text ByteString

-- | Modification time
[zipEntryTime] :: ZipEntry -> LocalTime

-- | Size of file data (if known); checked on zipping and also used as hint
--   to enable zip64. Disables compression for known 0-byte files.
[zipEntrySize] :: ZipEntry -> Maybe Word64

-- | Host-dependent attributes, often MS-DOS directory attribute byte (only
--   supported when zipping)
[zipEntryExternalAttributes] :: ZipEntry -> Maybe Word32

-- | Summary information at the end of a zip stream.
data ZipInfo
ZipInfo :: ByteString -> ZipInfo
[zipComment] :: ZipInfo -> ByteString


-- | Stream the creation of a zip file, e.g., as it's being uploaded.
module Codec.Archive.Zip.Conduit.Zip

-- | Stream produce a zip file, reading a sequence of entries with data.
--   Although file data is never kept in memory (beyond a single
--   <a>ZipDataByteString</a>), the format of zip files requires producing
--   a final directory of entries at the end of the file, consuming an
--   additional ~100 bytes of state per entry during streaming. The final
--   result is the total size of the zip file.
--   
--   Depending on options, the resulting zip file should be compatible with
--   most unzipping applications. Any errors are thrown in the underlying
--   monad (as <a>ZipError</a>s).
zipStream :: forall (m :: Type -> Type). (MonadThrow m, PrimMonad m) => ZipOptions -> ConduitM (ZipEntry, ZipData m) ByteString m Word64

-- | Options controlling zip file parameters and features
data ZipOptions
ZipOptions :: !Bool -> !Int -> !ZipInfo -> ZipOptions

-- | Allow <a>ZipDataSource</a>s over 4GB (reduces compatibility in some
--   cases); this is automatically enabled for any files of known size
--   (e.g., <a>zipEntrySize</a>)
[zipOpt64] :: ZipOptions -> !Bool

-- | Compress zipped files (0 = store only, 1 = minimal, 9 = best; non-zero
--   improves compatibility, since some unzip programs don't supported
--   stored, streamed files, including the one in this package)
[zipOptCompressLevel] :: ZipOptions -> !Int

-- | Other parameters to store in the zip file
[zipOptInfo] :: ZipOptions -> !ZipInfo

-- | Summary information at the end of a zip stream.
data ZipInfo
ZipInfo :: ByteString -> ZipInfo
[zipComment] :: ZipInfo -> ByteString
defaultZipOptions :: ZipOptions

-- | (The beginning of) a single entry in a zip stream, which may be any
--   file or directory. As per zip file conventions, directory names should
--   end with a slash and have no data, but this library does not ensure
--   that.
data ZipEntry
ZipEntry :: Either Text ByteString -> LocalTime -> Maybe Word64 -> Maybe Word32 -> ZipEntry

-- | File name (in posix format, no leading slashes), either UTF-8 encoded
--   text or raw bytes (CP437), with a trailing slash for directories
[zipEntryName] :: ZipEntry -> Either Text ByteString

-- | Modification time
[zipEntryTime] :: ZipEntry -> LocalTime

-- | Size of file data (if known); checked on zipping and also used as hint
--   to enable zip64. Disables compression for known 0-byte files.
[zipEntrySize] :: ZipEntry -> Maybe Word64

-- | Host-dependent attributes, often MS-DOS directory attribute byte (only
--   supported when zipping)
[zipEntryExternalAttributes] :: ZipEntry -> Maybe Word32

-- | The data contents for a <a>ZipEntry</a>. For empty entries (e.g.,
--   directories), use <a>mempty</a>.
data ZipData (m :: Type -> Type)

-- | A known ByteString, which will be fully evaluated (not streamed)
ZipDataByteString :: ByteString -> ZipData (m :: Type -> Type)

-- | A byte stream producer, streamed (and compressed) directly into the
--   zip
ZipDataSource :: ConduitM () ByteString m () -> ZipData (m :: Type -> Type)

-- | Use a file on disk as <a>ZipData</a> (<tt><a>ZipDataSource</a> .
--   <a>sourceFile</a></tt>).
zipFileData :: forall (m :: Type -> Type). MonadResource m => FilePath -> ZipData m
instance GHC.Classes.Eq Codec.Archive.Zip.Conduit.Zip.CentralDirectoryInfo
instance GHC.Classes.Eq Codec.Archive.Zip.Conduit.Zip.CommonFileHeaderInfo
instance GHC.Classes.Ord Codec.Archive.Zip.Conduit.Zip.CentralDirectoryInfo
instance GHC.Classes.Ord Codec.Archive.Zip.Conduit.Zip.CommonFileHeaderInfo
instance GHC.Internal.Show.Show Codec.Archive.Zip.Conduit.Zip.CentralDirectoryInfo
instance GHC.Internal.Show.Show Codec.Archive.Zip.Conduit.Zip.CommonFileHeaderInfo
