io - moving bytes between streams.
There are no interfaces in tau, so a reader is simply any object with a Read(n) that returns up to n bytes, and an empty bytes value when there is nothing left. A writer is any object with a Write(data) returning how many bytes went out. Files, network connections and buffers all have that shape, so they work here without knowing about each other.
¶IsReader = fn(r)source
IsReader reports whether r can be read from.
¶IsWriter = fn(w)source
IsWriter reports whether w can be written to.
¶ReadAll = fn(r)source
ReadAll returns everything left in r.
¶ReadFull = fn(r, n)source
ReadFull returns exactly n bytes, or fewer if the stream ends first.
¶Copy = fn(dst, src)source
Copy moves everything from src to dst and returns how many bytes it moved.
¶CopyN = fn(dst, src, n)source
CopyN moves at most n bytes from src to dst.
¶WriteString = fn(w, s)source
WriteString writes a string to a writer.