Streaming replace of file content before reading into lines

Sorry, it seems to be a simple question, but I’m not able to figure out how to do it in Julia. We receive text files, but they have ‘\01’ or ‘\00’ as newline. We’d like read (stream) the file content, map ‘\01’ to ‘\r’ and then continue reading the lines. Something like (pseudo code):

    open("myfile.dat", read=true) do fd
        # fd = map(fd, '\01' => '\r')    # <= How to do this?
        fd = replace(fd, '\01' => '\r')    # More appropriate, as pointed our by nilshg
        for line in eachline(fd)

Preferably it should work with input from files, cmds and IOBuffer

I know we could invoke an external command to do the translation, but we are using Windows as well as Linux, and we’d like an approach that easily works on both.

Thanks a lot for your help

I’m not sure I understand what you mean by map - your pseudocode looks as if you might be looking for replace?

good point, replace is more appropriate.

May be also not explicit enough in text: we want to stream the data, as the files are large. Reading all of the file content into memory, replace, and then split into lines, is not what we are looking for.

Is anybody able to help me with this?