upload progress bars for webdav!

This commit is contained in:
Joey Hess 2012-11-18 20:06:28 -04:00
parent c8751be151
commit afa2f9c967
4 changed files with 66 additions and 11 deletions

View file

@ -19,6 +19,7 @@ module Crypto (
decryptCipher,
encryptKey,
feedFile,
feedFileMetered,
feedBytes,
readBytes,
encrypt,
@ -36,6 +37,8 @@ import Common.Annex
import qualified Utility.Gpg as Gpg
import Types.Key
import Types.Crypto
import Types.Remote
import Utility.Observed
{- The first half of a Cipher is used for HMAC; the remainder
- is used as the GPG symmetric encryption passphrase.
@ -122,6 +125,11 @@ type Reader a = Handle -> IO a
feedFile :: FilePath -> Feeder
feedFile f h = L.hPut h =<< L.readFile f
feedFileMetered :: FilePath -> MeterUpdate -> Feeder
feedFileMetered f m to = withBinaryFile f ReadMode $ \h -> do
b <- hGetContentsObserved h $ m . toInteger
L.hPut to b
feedBytes :: L.ByteString -> Feeder
feedBytes = flip L.hPut