Last active
January 25, 2018 11:52
-
-
Save v0d1ch/76cf5acf55f844fa1a942545cdb4212b to your computer and use it in GitHub Desktop.
yesod streaming
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body <- getRequest | |
| lift $ runConduitRes $ (consumeBody body) =$ sinkFile directory | |
| where | |
| consumeBody :: MonadIO m => YesodRequest -> ConduitM i ByteString m () | |
| consumeBody body = do | |
| chunk <- liftIO $ NW.requestBody $ reqWaiRequest body | |
| if (chunk == BS.empty) | |
| then return () | |
| else do | |
| yield chunk | |
| consumeBody body |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment