zip-archive 0.2.2.1 → 0.2.3
raw patch · 2 files changed
+10/−3 lines, 2 filesdep ~binary
Dependency ranges changed: binary
Files
- src/Codec/Archive/Zip.hs +9/−1
- zip-archive.cabal +1/−2
src/Codec/Archive/Zip.hs view
@@ -38,6 +38,7 @@ -- * Pure functions for working with zip archives , toArchive+ , toArchiveOrFail , fromArchive , filesInArchive , addEntryToArchive@@ -156,6 +157,13 @@ toArchive :: B.ByteString -> Archive toArchive = decode +-- | Like 'toArchive', but returns an 'Either' value instead of raising an error+-- if the archive cannot be decoded.+toArchiveOrFail :: B.ByteString -> Either String Archive+toArchiveOrFail bs = case decodeOrFail bs of+ Left (_,_,e) -> Left e+ Right (_,_,x) -> Right x+ -- | Writes an 'Archive' structure to a raw zip archive (in a lazy bytestring). fromArchive :: Archive -> B.ByteString fromArchive = encode@@ -573,7 +581,7 @@ putLocalFile f = do putWord32le 0x04034b50 putWord16le 20 -- version needed to extract (>=2.0)- putWord16le 2 -- general purpose bit flag (max compression)+ putWord16le 0x802 -- general purpose bit flag (bit 1 = max compression, bit 11 = UTF-8) putWord16le $ case eCompressionMethod f of NoCompression -> 0 Deflate -> 8
zip-archive.cabal view
@@ -1,5 +1,5 @@ Name: zip-archive-Version: 0.2.2.1+Version: 0.2.3 Cabal-Version: >= 1.10 Build-type: Simple Synopsis: Library for creating and modifying zip archives.@@ -34,7 +34,6 @@ Default-Language: Haskell98 Hs-Source-Dirs: src Ghc-Options: -Wall- Default-Extensions: CPP if os(windows) cpp-options: -D_WINDOWS else