Closed shoce closed 3 years ago
I need this for a tool i am developing right now. The tool syncs a big file between two machines. If the downloading side has the file with the same name and size smaller than the file on the other side, then the tool checks if hashes are the same. So for this i need to check hash of the first n bytes of the file.
Please wrap your io.Reader
in an io.LimitedReader
. There's no need to add a new function.
Please wrap your
io.Reader
in anio.LimitedReader
. There's no need to add a new function.
Wow thanks, i did not know about io.LimitedReader existence.
func SumStreamN(r io.Reader, n int64, code uint64, length int) (Multihash, error)
that uses io.CopyN instead of io.Copy