Created
December 29, 2011 00:28
-
-
Save wavewave/1530707 to your computer and use it in GitHub Desktop.
simple gunzip test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Control.Monad | |
| import qualified Data.ByteString.Lazy as B | |
| import qualified Codec.Compression.GZip as GZip | |
| import System.IO | |
| main :: IO () | |
| main = do | |
| putStrLn "gzip test" | |
| withFile "testtest.hs.gz" ReadMode $ \h -> do | |
| bcontents <- B.hGetContents h | |
| b <- return . B.any ( == 0 ) . B.take 100 $ bcontents | |
| when b $ do | |
| let content = GZip.decompress bcontents | |
| B.putStrLn content | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment