module Network.Socket.SendFile.Handle (
ByteCount,
Offset,
Iter(..), runIter,
sendFile,
sendFileIterWith,
sendFile',
sendFileIterWith'
) where
import System.IO (Handle, hFileSize)
import qualified Network.Socket.SendFile.Internal as Internal
import Network.Socket.SendFile.Iter (Iter(..), runIter)
import Network.Socket.SendFile (ByteCount, Offset)
import Network.Socket (Socket)
sendFile
:: Socket
-> Handle
-> IO ()
sendFile :: Socket -> Handle -> IO ()
sendFile Socket
outs Handle
inh = do
Integer
count <- Handle -> IO Integer
hFileSize Handle
inh
Socket -> Handle -> Integer -> Integer -> IO ()
Internal.sendFile'' Socket
outs Handle
inh Integer
0 Integer
count
sendFileIterWith
:: (IO Iter -> IO a)
-> Socket
-> Handle
-> ByteCount
-> IO a
sendFileIterWith :: forall a. (IO Iter -> IO a) -> Socket -> Handle -> Integer -> IO a
sendFileIterWith IO Iter -> IO a
stepper Socket
outs Handle
inh Integer
blockSize = do
Integer
count <- Handle -> IO Integer
hFileSize Handle
inh
forall a.
(IO Iter -> IO a)
-> Socket -> Handle -> Integer -> Integer -> Integer -> IO a
Internal.sendFileIterWith'' IO Iter -> IO a
stepper Socket
outs Handle
inh Integer
blockSize Integer
0 Integer
count
sendFile'
:: Socket
-> Handle
-> Offset
-> ByteCount
-> IO ()
sendFile' :: Socket -> Handle -> Integer -> Integer -> IO ()
sendFile' = Socket -> Handle -> Integer -> Integer -> IO ()
Internal.sendFile''
sendFileIterWith'
:: (IO Iter -> IO a)
-> Socket
-> Handle
-> ByteCount
-> Offset
-> ByteCount
-> IO a
sendFileIterWith' :: forall a.
(IO Iter -> IO a)
-> Socket -> Handle -> Integer -> Integer -> Integer -> IO a
sendFileIterWith' = forall a.
(IO Iter -> IO a)
-> Socket -> Handle -> Integer -> Integer -> Integer -> IO a
Internal.sendFileIterWith''