readAll

public func readAll[R](mutating R, into: mutating Array[UInt8]) -> Result[Int64, IoError] where R: Readable, R: not Copyable

Drains reader into buf, appending every byte until EOF. Reads in 4 KiB chunks. Returns the total number of bytes appended.

Examples

var bytes = Array[UInt8](); var file = try File.open("input.bin"); let total = try readAll(file, into: bytes);

Defined in lang/std/io/read.ks