What is the recommended way to decorate an IO stream with a filter in Julia

What is the recommended way to decorate a IO stream with a filter?

One great example of stream decorators is CodecZlib.jl that provides compression and decompression decorators for output and input streams respectively.
However, I could not find decorators for stream filtering. For an example in the standard Java library we have
java.io.FilterInputStream and java.io.FilterOuputStream.

Of course I could extend the IO type and provide my own implementation but I assume there is already some package for that?

Sample use case could having a 100GB file that I want to filter in-flight before it gets to functions such as CSV.read. It is easy to do when saving a temporary file and then loading by CSV.read but this something I would like to avoid.

1 Like

I think a custom codec with https://github.com/bicycle1885/TranscodingStreams.jl should work for you.

1 Like