Skip to content

Instantly share code, notes, and snippets.

@wavewave
Created December 29, 2011 00:28
Show Gist options
  • Save wavewave/1530707 to your computer and use it in GitHub Desktop.
Save wavewave/1530707 to your computer and use it in GitHub Desktop.
simple gunzip test
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