I have a Yesod application (but question is more general than this) that allows file uploads. I also allow file dowloads. I would like to allow users download multiple files with single link. As per this question: How to download multiple files with one HTTP request? the only solution seems to be creation of file archive with all the files inside.
I want to do it in constant memory in Haskell using libraries from Hackage, without writing to disk or executing external programs.
In particular the following are non-solutions:
calling external programs to create an archive: the files may be on disk or in some database on accessible via some remote url. the filesystem may be "read only". executing external programs may be impossible for security reasons. external programs complicate deployment.
creating temporary archive on disk from source files: see "read only" filesystem above. Also quite inefficient: writing to disk is pretty slow actually.
creating complete archive in memory and serving it afterwards: the files may be quite large (think CD images) and multiple. The memory needed would be too great.