Hello,
I'm coming from the Go language, and there there are nice I/O interface types : io.Reader, io.Writer, and similar. Those are interfaces types meaning that it can be backed by any implementation and those types can be used anywhere in the language to represent readable or writable streams. This is important because you can pass the stream to a JSON library for encoding/decoding, you can pass it to hash functions to compute a digest, you can copy them from one to another.
In Nim, I'm currently in need of stream types that could be ubiquous.
I have a small HTTP service that is currently using the zfblast HTTP server implementation but I have trouble to make it work the way I need (listen to multiple IP addresses including IPv6). I'm considering moving to the standard library asynchttpserver but there is an issue with it as well because the whole request / response is stored as a string, which can cause issues with large requests/responses (uploads/downloads). So I wanted to write yet another HTTP server library that would alleviate those issues. In particular representing the HTTP request and response as a stream and not an in-memory blob.
What would be your advice in terms of stream library that support async operation? Is there something that could be flexible enough to be used in a variety of contexts?
Thank you
I was under the impression that asyncsteams was a generic stream of futures, could it work for a byte stream. I need to be able to read/write whole chunks of data of arbitrary length, and signal for end of file.
I'll look into it.
I also saw https://nimble.directory/pkg/faststreams which is promising but it seems a bit specialized and not too easy to create your own kind of streams. Also, it might not be used enough to be interesting to implement.