We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3f63438 + 8ddd8ec commit 6416d36Copy full SHA for 6416d36
1 file changed
Streaming/Zip.hs
@@ -4,6 +4,7 @@ module Streaming.Zip (
4
-- * Streams
5
decompress
6
, decompress'
7
+ , decompressAll
8
, compress
9
, gunzip
10
, gunzip'
@@ -83,6 +84,14 @@ decompress' wbits p0 = go p0 =<< liftIO (Z.initInflate wbits)
83
84
else return $ Left (chunk leftover >> p')
85
{-# INLINABLE decompress' #-}
86
87
+-- | Keep decompressing a compressed bytestream until exhausted.
88
+decompressAll :: MonadIO m => Z.WindowBits -> ByteString m r -> ByteString m r
89
+decompressAll w bs = decompress' w bs >>= go
90
+ where
91
+ go (Left bs) = decompress' w bs >>= go
92
+ go (Right r) = return r
93
+{-# INLINABLE decompressAll #-}
94
+
95
-- | Compress a byte stream.
96
--
97
-- See the "Codec.Compression.Zlib" module for details about
0 commit comments