-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | A library for tracking the consumption of a lazy ByteString
--   
--   In some cases, it is useful to know how fast a ByteString is being
--   consumed. Typically, this could be to report some measure of progress
--   to a waiting user, but it could also be to perform some form of
--   testing on input / consumption code.
@package bytestring-progress
@version 1.4

-- | This module defines core functions for tracking the consumption of a
--   ByteString, as well as several helper functions for making tracking
--   ByteStrings easier.
module Data.ByteString.Lazy.Progress

-- | Given a function, return a bytestring that will call that function
--   when it is partially consumed. The Words provided to the function will
--   be the number of bytes that were just consumed and the total bytes
--   consumed thus far.
trackProgress :: (Word64 -> Word64 -> IO ()) -> ByteString -> IO ByteString

-- | Works like trackProgress, except uses fixed-size chunks of the
--   given size. Thus, for this function, the first number passed to your
--   function will always be the given size *except* for the last call to
--   the function, which will be less then or equal to the final size.
trackProgressWithChunkSize :: Word64 -> (Word64 -> Word64 -> IO ()) -> ByteString -> IO ByteString

-- | Given a format string (described below), track the progress of a
--   function. The argument to the callback will be the string expanded
--   with the given progress information.
--   
--   Format string items:
--   
--   
--   
- %b is the number of bytes read
--   
- %B is the number of bytes read, formatted into a human-readable
--   string
--   
- %c is the size of the last chunk read
--   
- %C is the size of the last chunk read, formatted
--   human-readably
--   
- %r is the rate in bytes per second
--   
- %R is the rate, formatted human-readably
--   
- %% is the character %
--   
--   
--   If you provide a total size (the maybe argument, in bytes), then you
--   may also use the following items:
--   
--   
--   
- %t is the estimated time to completion in seconds
--   
- %T is the estimated time to completion, formatted as HH:MM:SS
--   
- %p is the percentage complete
--   
trackProgressString :: String -> Maybe Word64 -> (String -> IO ()) -> IO (ByteString -> IO ByteString)

-- | Exactly as trackProgressString, but use the given chunkSize
--   instead of the default chunk size.
trackProgressStringWithChunkSize :: String -> Word64 -> Maybe Word64 -> (String -> IO ()) -> IO (ByteString -> IO ByteString)

-- | Convert a number of bytes to a string represenation that uses a
--   reasonable unit to make the number human-readable.
bytesToUnittedStr :: Word64 -> String
