-- 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.1 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 :: ByteString -> LocalTime -> Maybe Word64 -> ZipEntry -- | File name (in posix format, no leading slashes), usually utf-8 -- encoded, with a trailing slash for directories [zipEntryName] :: ZipEntry -> ByteString -- | Modification time [zipEntryTime] :: ZipEntry -> LocalTime -- | Size of file data (if known); checked on zipping and also used as hint -- to enable zip64 [zipEntrySize] :: ZipEntry -> Maybe Word64 -- | The data contents for a ZipEntry. For empty entries (e.g., -- directories), use mempty. data ZipData m -- | A known ByteString, which will be fully evaluated (not streamed) ZipDataByteString :: ByteString -> ZipData m -- | A byte stream producer, streamed (and compressed) directly into the -- zip ZipDataSource :: (Source m ByteString) -> ZipData m -- | Normalize any ZipData to a simple source sourceZipData :: Monad m => ZipData m -> Source m ByteString instance GHC.Show.Show Codec.Archive.Zip.Conduit.Types.ZipEntry instance GHC.Classes.Eq Codec.Archive.Zip.Conduit.Types.ZipEntry instance GHC.Show.Show Codec.Archive.Zip.Conduit.Types.ZipInfo instance GHC.Classes.Eq Codec.Archive.Zip.Conduit.Types.ZipInfo instance GHC.Show.Show Codec.Archive.Zip.Conduit.Types.ZipError instance Data.String.IsString Codec.Archive.Zip.Conduit.Types.ZipError instance GHC.Exception.Exception Codec.Archive.Zip.Conduit.Types.ZipError instance GHC.Base.Monad m => GHC.Base.Monoid (Codec.Archive.Zip.Conduit.Types.ZipData m) -- | 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: Left (ZipEntry -- "directory/" ...), Left (ZipEntry "directory/file.txt" ...), Right -- "hello w", Right "orld!\n", Left ... 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 ZipErrors or ParseError). unZipStream :: (MonadBase b m, PrimMonad b, MonadThrow 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 :: ByteString -> LocalTime -> Maybe Word64 -> ZipEntry -- | File name (in posix format, no leading slashes), usually utf-8 -- encoded, with a trailing slash for directories [zipEntryName] :: ZipEntry -> ByteString -- | Modification time [zipEntryTime] :: ZipEntry -> LocalTime -- | Size of file data (if known); checked on zipping and also used as hint -- to enable zip64 [zipEntrySize] :: ZipEntry -> Maybe Word64 -- | 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 -- ZipDataByteString), 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 ZipErrors). zipStream :: (MonadBase b m, PrimMonad b, MonadThrow m) => ZipOptions -> ConduitM (ZipEntry, ZipData m) ByteString m Word64 -- | Options controlling zip file parameters and features data ZipOptions ZipOptions :: Bool -> Int -> ZipInfo -> ZipOptions -- | Allow ZipDataSources over 4GB (reduces compatibility in some -- cases); this is automatically enabled for any files of known size -- (e.g., zipEntrySize) [zipOpt64] :: ZipOptions -> Bool -- | Compress (0 = store only, 9 = best) zipped files (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 :: ByteString -> LocalTime -> Maybe Word64 -> ZipEntry -- | File name (in posix format, no leading slashes), usually utf-8 -- encoded, with a trailing slash for directories [zipEntryName] :: ZipEntry -> ByteString -- | Modification time [zipEntryTime] :: ZipEntry -> LocalTime -- | Size of file data (if known); checked on zipping and also used as hint -- to enable zip64 [zipEntrySize] :: ZipEntry -> Maybe Word64 -- | The data contents for a ZipEntry. For empty entries (e.g., -- directories), use mempty. data ZipData m -- | A known ByteString, which will be fully evaluated (not streamed) ZipDataByteString :: ByteString -> ZipData m -- | A byte stream producer, streamed (and compressed) directly into the -- zip ZipDataSource :: (Source m ByteString) -> ZipData m -- | Use a file on disk as ZipData (ZipDataSource . -- sourceFile). zipFileData :: MonadResource m => FilePath -> ZipData m