This PR let's people use a RequestBody instead of Lazy Bytestring to create an attachment. This gives people more fine grained control on how the content of the attachment is loaded. For example, in my use case, I had to load a file from Amazon S3, and upload it as an attachment. However due to the memory limit of the VM I'm running the bot on, it would crash due to OOM if I try to upload a huge file. Fiddling with Lazy Bytestring wasn't yielding any good results so I came up with this PR.
With this PR, I can upload a body :: ConduitM () ByteString (ResourceT IO) () with requestBodySourceChunked from http-conduit, without running into memory problems.
let file = CreateMessageAttachment filename Nothing $ requestBodySourceChunked body
followUp (intoMsg ([i|<@#{showID $ user ^. #id}>|] :: Text) <> intoMsg file)
This PR let's people use a
RequestBody
instead of Lazy Bytestring to create an attachment. This gives people more fine grained control on how the content of the attachment is loaded. For example, in my use case, I had to load a file from Amazon S3, and upload it as an attachment. However due to the memory limit of the VM I'm running the bot on, it would crash due to OOM if I try to upload a huge file. Fiddling with Lazy Bytestring wasn't yielding any good results so I came up with this PR.With this PR, I can upload a
body :: ConduitM () ByteString (ResourceT IO) ()
withrequestBodySourceChunked
from http-conduit, without running into memory problems.