1-----------------------------------------------------------------------------
2-- |
3-- Copyright   :  (c) 2006-2014 Duncan Coutts
4-- License     :  BSD-style
5--
6-- Maintainer  :  duncan@community.haskell.org
7--
8-- Compression and decompression of data streams in the raw deflate format.
9--
10-- The format is described in detail in RFC #1951:
11-- <http://www.ietf.org/rfc/rfc1951.txt>
12--
13-- See also the zlib home page: <http://zlib.net/>
14--
15-----------------------------------------------------------------------------
16module Codec.Compression.Zlib.Raw (
17
18  -- * Simple compression and decompression
19  compress,
20  decompress,
21
22  -- * Extended api with control over compression parameters
23  compressWith,
24  decompressWith,
25
26  CompressParams(..), defaultCompressParams,
27  DecompressParams(..), defaultDecompressParams,
28
29  -- ** The compression parameter types
30  CompressionLevel(..),
31    defaultCompression,
32    noCompression,
33    bestSpeed,
34    bestCompression,
35    compressionLevel,
36  Method(..),
37    deflateMethod,
38  WindowBits(..),
39    defaultWindowBits,
40    windowBits,
41  MemoryLevel(..),
42    defaultMemoryLevel,
43    minMemoryLevel,
44    maxMemoryLevel,
45    memoryLevel,
46  CompressionStrategy(..),
47    defaultStrategy,
48    filteredStrategy,
49    huffmanOnlyStrategy,
50
51  ) where
52
53import Data.ByteString.Lazy (ByteString)
54
55import qualified Codec.Compression.Zlib.Internal as Internal
56import Codec.Compression.Zlib.Internal hiding (compress, decompress)
57
58decompress :: ByteString -> ByteString
59decompress = decompressWith defaultDecompressParams
60
61decompressWith :: DecompressParams -> ByteString -> ByteString
62decompressWith = Internal.decompress rawFormat
63
64compress :: ByteString -> ByteString
65compress = compressWith defaultCompressParams
66
67compressWith :: CompressParams -> ByteString -> ByteString
68compressWith = Internal.compress rawFormat
69