Safe Haskell | None |
---|---|
Language | Haskell2010 |
Codec.Archive.Zip.Conduit.Zip
Description
Stream the creation of a zip file, e.g., as it's being uploaded.
Synopsis
- zipStream :: (MonadThrow m, PrimMonad m) => ZipOptions -> ConduitM (ZipEntry, ZipData m) ByteString m Word64
- data ZipOptions = ZipOptions {}
- data ZipInfo = ZipInfo {}
- defaultZipOptions :: ZipOptions
- data ZipEntry = ZipEntry {}
- data ZipData m
- = ZipDataByteString ByteString
- | ZipDataSource (ConduitM () ByteString m ())
- zipFileData :: MonadResource m => FilePath -> ZipData m
Documentation
zipStream :: (MonadThrow m, PrimMonad m) => ZipOptions -> ConduitM (ZipEntry, ZipData m) ByteString m Word64 Source #
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 ZipError
s).
data ZipOptions Source #
Options controlling zip file parameters and features
Constructors
ZipOptions | |
Fields
|
Summary information at the end of a zip stream.
Constructors
ZipInfo | |
Fields |
(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.
Constructors
ZipEntry | |
Fields
|
Constructors
ZipDataByteString ByteString | A known ByteString, which will be fully evaluated (not streamed) |
ZipDataSource (ConduitM () ByteString m ()) | A byte stream producer, streamed (and compressed) directly into the zip |
zipFileData :: MonadResource m => FilePath -> ZipData m Source #
Use a file on disk as ZipData
(
).ZipDataSource
. sourceFile