Repository navigation
Tags
Tags
add `Progress` and `ProgressReader` types This commit adds two new types for measuring progress of I/O operations. A `Progress` represents the status of an I/O operation. It contains the number of bytes read since the last progress reporting, the number of bytes processed in total so far and a potential error. The `ProgressReader` wraps an `io.Reader` and sends progress updates to its `Update` callback. By default, it calls the `Update` callback after every completed read. However, users can specify: - an `UpdateAfter` size causing the `ProgressReader` to invoke the callback once it has read at least `UpdateAfter` bytes since the last update. - an `UpdateEvery` duration causing the `ProgressReader` to invoke the callback only if no update has happened for at least `UpdateEvery` time period. Signed-off-by: Andreas Auernhammer <hi@aead.dev>