If anyone more experienced with Swift feels like commenting on this PR I'd be grateful! This is an attempt to create BufReader and BufWriter similar to Rust, but for swift, mostly for CLI type programs / data crunching on files that are too large to hold in memory. This is a first pass at the BufReader
The intent would be for this to be cross platform and not just for Mac, which I think means I'd need to not use FileHandle from Foundations?
If this is primarily for file systems, have you had a look at NIOFilesystem in SwiftNIO https://github.com/apple/swift-nio/pull/2615 which just landed. It's not in a release yet though. If you want a cross platform solution not dependent on Foundation this might be worth looking into.
On reading more, Foundation is supported on linux it looks like, so FileHandle should be cross-platform enough for me. I do think there's value in having sync versions of BufReader and BufWriter (at least for myself wring CLI tools). Reading the NIO code is very instructive on writing better Swift though!
A thing worth considering is that swift-corelibs-foundation is no longer actively maintained, while SwiftNIO is. OTOH swift-corelibs-foundation supports Windows (to some degree), unlike SwiftNIO.