diff --git a/Codec/Zlib.hs b/Codec/Zlib.hs
--- a/Codec/Zlib.hs
+++ b/Codec/Zlib.hs
@@ -25,14 +25,16 @@
     , initInflateWithDictionary
     , withInflateInput
     , finishInflate
+    , flushInflate
       -- * Deflate
     , Deflate
     , initDeflate
     , initDeflateWithDictionary
     , withDeflateInput
     , finishDeflate
+    , flushDeflate
       -- * Data types
-    , WindowBits (WindowBits)
+    , WindowBits (..)
     , defaultWindowBits
     , ZlibException (..)
     ) where
@@ -214,8 +216,20 @@
         withForeignPtr fbuff $ \buff -> do
             avail <- c_get_avail_out zstr
             let size = defaultChunkSize - fromIntegral avail
-            S.packCStringLen (buff, size)
+            bs <- S.packCStringLen (buff, size)
+            c_set_avail_out zstr buff
+                $ fromIntegral defaultChunkSize
+            return bs
 
+-- | Flush the inflation buffer. Useful for interactive application.
+--
+-- This is actually a synonym for 'finishInflate'. It is provided for its more
+-- semantic name.
+--
+-- Since 0.0.3
+flushInflate :: Inflate -> IO S.ByteString
+flushInflate = finishInflate
+
 -- | Feed the given 'S.ByteString' to the deflater. This function takes a
 -- function argument which takes a \"popper\". A popper is an IO action that
 -- will return the next bit of deflated data, returning 'Nothing' when there is
@@ -244,3 +258,12 @@
     withForeignPtr fzstr $ \zstr ->
         f $ drain fbuff zstr c_call_deflate_finish True
 
+-- | Flush the deflation buffer. Useful for interactive application.
+--
+-- Internally this passes Z_SYNC_FLUSH to the zlib library.
+--
+-- Since 0.0.3
+flushDeflate :: Deflate -> (IO (Maybe S.ByteString) -> IO a) -> IO a
+flushDeflate (Deflate (fzstr, fbuff)) f =
+    withForeignPtr fzstr $ \zstr ->
+        f $ drain fbuff zstr c_call_deflate_flush True
diff --git a/Codec/Zlib/Lowlevel.hs b/Codec/Zlib/Lowlevel.hs
--- a/Codec/Zlib/Lowlevel.hs
+++ b/Codec/Zlib/Lowlevel.hs
@@ -16,6 +16,7 @@
     , c_call_inflate_noflush
     , c_call_deflate_noflush
     , c_call_deflate_finish
+    , c_call_deflate_flush
     , c_call_deflate_set_dictionary
     , c_call_inflate_set_dictionary
     ) where
@@ -80,6 +81,9 @@
 
 foreign import ccall unsafe "call_deflate_finish"
     c_call_deflate_finish :: ZStream' -> IO CInt
+
+foreign import ccall unsafe "call_deflate_flush"
+    c_call_deflate_flush :: ZStream' -> IO CInt
 
 foreign import ccall unsafe "deflate_set_dictionary"
     c_call_deflate_set_dictionary :: ZStream' -> Ptr CChar -> CUInt -> IO ()
diff --git a/c/helper.c b/c/helper.c
--- a/c/helper.c
+++ b/c/helper.c
@@ -81,6 +81,11 @@
 	return deflate(stream, Z_NO_FLUSH);
 }
 
+int call_deflate_flush (z_stream *stream)
+{
+	return deflate(stream, Z_SYNC_FLUSH);
+}
+
 int call_deflate_finish (z_stream *stream)
 {
 	return deflate(stream, Z_FINISH);
diff --git a/test/main.hs b/test/main.hs
--- a/test/main.hs
+++ b/test/main.hs
@@ -13,7 +13,7 @@
 import qualified Data.ByteString as S
 import qualified Data.ByteString.Char8 as S8
 import qualified Data.ByteString.Lazy as L
-import Control.Monad (foldM)
+import Control.Monad (foldM, forM_, forM)
 import System.IO.Unsafe (unsafePerformIO)
 
 decompress' :: L.ByteString -> L.ByteString
@@ -174,3 +174,34 @@
             deflated <- foldM (go' def) id $ L.toChunks lbs
             deflated' <- finishDeflate def $ go deflated
             return $ lbs == decompress (L.fromChunks (deflated' []))
+
+    describe "flushing" $ do
+        let helper wb = do
+                let bss0 = replicate 5000 "abc"
+                def <- initDeflate 9 wb
+                inf <- initInflate wb
+
+                let popList pop = do
+                        mx <- pop
+                        case mx of
+                            Nothing -> return []
+                            Just x -> do
+                                xs <- popList pop
+                                return $ x : xs
+
+                let callback name expected pop = do
+                        bssDeflated <- popList pop
+                        bsInflated <- fmap (S.concat . concat) $ forM bssDeflated $ \bs -> do
+                            x <- withInflateInput inf bs popList
+                            y <- flushInflate inf
+                            return $ x ++ [y]
+                        if bsInflated == expected
+                            then return ()
+                            else error $ "callback " ++ name ++ ", got: " ++ show bsInflated ++ ", expected: " ++ show expected
+
+                forM_ (zip [1..] bss0) $ \(i, bs) -> do
+                    withDeflateInput def bs $ callback ("loop" ++ show (i :: Int)) ""
+                    flushDeflate def $ callback ("loop" ++ show (i :: Int)) bs
+                finishDeflate def $ callback "finish" ""
+        it "zlib" $ helper defaultWindowBits
+        it "gzip" $ helper $ WindowBits 31
diff --git a/zlib-bindings.cabal b/zlib-bindings.cabal
--- a/zlib-bindings.cabal
+++ b/zlib-bindings.cabal
@@ -1,10 +1,11 @@
 name:            zlib-bindings
-version:         0.0.2
+version:         0.0.3
 license:         BSD3
 license-file:    LICENSE
 author:          Michael Snoyman <michael@snoyman.com>
 maintainer:      Michael Snoyman <michael@snoyman.com>
 synopsis:        Low-level bindings to the zlib package.
+description:     Provides necessary functions for producing a streaming interface. This is used for example by @zlib-conduit@ and @zlib-enum@.
 category:        Codec
 stability:       Experimental
 cabal-version:   >= 1.8
@@ -13,13 +14,8 @@
 extra-source-files: cbits/crc32.h cbits/inffast.h cbits/inflate.h
                     cbits/trees.h cbits/deflate.h cbits/inffixed.h
                     cbits/inftrees.h cbits/zutil.h, test/main.hs
-flag test
-  description: Build the test executable.
-  default: False
 
 library
-    if flag(test)
-        Buildable: False
     build-depends: base                  >= 4       && < 5
                  , bytestring            >= 0.9.1.4 && < 0.10
                  , zlib                  >= 0.5.2.0 && < 0.6
