
Hi, I´m streaming content using lazy bytestrings in a web application. The problem is that the output comes in huge blobs (presumably of 32k) one at a time. This is good for some purposes, but not for console-like interfaces or runtime log visualization. (one of my purposes is to web-alize ghci. I know that this can be done without streaming the standard output, but I want it that way). I can not control when the IO bytestring primitives flush the data to the stream, because this is not part of my application (nor does it should do it). I suppose here that it is in a chunk by chunk basis. But maybe I misinterpreted something or everything. I use the package hack with the server hack-handler-simpleserver. this serves does Data.ByteString.hPut the bytestring content... I use mappend to add content to the stream. mappend uses "append" which uses. "foldrChunks" which seems not to compact two bytestrings in max size chunks . So I do not know what happens. The question is: are there some way to control bytestring streaming?. Can It be done without the stream handler? Alberto.

On Tue, 27 Jul 2010, Alberto G. Corona wrote:
The question is: are there some way to control bytestring streaming?. Can It be done without the stream handler?
I think there is a function that converts a lazy ByteString to a list of strict ByteStrings, that should work without copying the chunk data around. On this chunk list you can do all kind of manipulations, like merging adjacent small chunks.
participants (2)
-
Alberto G. Corona
-
Henning Thielemann