Std.Io.foldChunks
1 declaration
fn
foldChunks: &Std.Io.Reader -> T -> fn(T, Bytes) -> T -> Result[T, Std.Io.IoError]This is a callable function.
What it does
Combine every chunk of a file into one value, holding one chunk at a time.
What it costs to run does not depend on how large the file is, which is the
whole of what streaming buys: a file larger than memory is folded here and
cannot be read by anything that materialises it first.
Read the signature
- The text after the name is the type checked by Pudu.
- Read arrows from left to right: inputs come first, and the final type is returned.
- & borrows a value for this call instead of moving or copying it.
- Names inside [ ] are type arguments, such as the item type held by a collection.
- Result makes success and recoverable failure part of the function's type.
