zip-archive 0.1.4 → 0.2
raw patch · 2 files changed
+17/−6 lines, 2 filesdep +textdep −utf8-string
Dependencies added: text
Dependencies removed: utf8-string
Files
- src/Codec/Archive/Zip.hs +15/−4
- zip-archive.cabal +2/−2
src/Codec/Archive/Zip.hs view
@@ -85,8 +85,9 @@ -- from bytestring import qualified Data.ByteString.Lazy as B --- from utf8-string-import Data.ByteString.Lazy.UTF8 ( toString, fromString )+-- text+import qualified Data.Text.Lazy as TL+import qualified Data.Text.Lazy.Encoding as TL -- from zlib import qualified Codec.Compression.Zlib.Raw as Zlib@@ -113,6 +114,10 @@ , zComment :: B.ByteString -- ^ Comment for whole zip archive } deriving (Read, Show) +instance Binary Archive where+ put = putArchive+ get = getArchive+ -- | Representation of an archived file, including content and metadata. data Entry = Entry { eRelativePath :: FilePath -- ^ Relative path, using '/' as separator@@ -148,11 +153,11 @@ -- | Reads an 'Archive' structure from a raw zip archive (in a lazy bytestring). toArchive :: B.ByteString -> Archive-toArchive = runGet getArchive+toArchive = decode -- | Writes an 'Archive' structure to a raw zip archive (in a lazy bytestring). fromArchive :: Archive -> B.ByteString-fromArchive = runPut . putArchive+fromArchive = encode -- | Returns a list of files in a zip archive. filesInArchive :: Archive -> [FilePath]@@ -719,3 +724,9 @@ if p val then return () else fail "ensure not satisfied"++toString :: B.ByteString -> String+toString = TL.unpack . TL.decodeUtf8++fromString :: String -> B.ByteString+fromString = TL.encodeUtf8 . TL.pack
zip-archive.cabal view
@@ -1,5 +1,5 @@ Name: zip-archive-Version: 0.1.4+Version: 0.2 Cabal-Version: >= 1.10 Build-type: Simple Synopsis: Library for creating and modifying zip archives.@@ -29,7 +29,7 @@ Build-depends: base >= 3 && < 5, pretty, containers else Build-depends: base < 3- Build-depends: binary >= 0.5, zlib, filepath, bytestring >= 0.9.0, array, mtl, utf8-string >= 0.3.1, old-time, digest >= 0.0.0.1, directory, time+ Build-depends: binary >= 0.5, zlib, filepath, bytestring >= 0.9.0, array, mtl, text >= 0.11, old-time, digest >= 0.0.0.1, directory, time Exposed-modules: Codec.Archive.Zip Default-Language: Haskell98 Hs-Source-Dirs: src