Reader return EndOfStream before remaining bytes

I’m not really sure about what you actually want or need as you haven’t really talked about what you tried to achieve, but here’s my guess nonetheless: you want to read a file line by line?
If that’s the case you could take a look at peekDelimiter and friends. And also this post here.

If you really want to read it in segments of size buff.len you could take a look at readSliceShort or readSliceAll if you do want the error when finished.


Also I would personally just do this here:

var reader = file.reader(io, &buff);
// ...
const slice = try reader.interface.take(buff.len) catch break;

Instead of const r = &reader.interface. It’s a bit more typing but much clearer and you don’t have to come up with two names for (essentially) the same thing.