2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-25 14:17:42 +00:00

Extend cmd/split

This commit is contained in:
Alexander Neumann 2014-09-18 22:40:59 +02:00
parent 878a96e761
commit 16dfd73ecb

View File

@ -31,7 +31,14 @@ func main() {
for {
chunk, err := ch.Next()
if chunk != nil {
if err == io.EOF {
break
}
if err != nil {
panic(err)
}
fmt.Printf("%d %016x %02x\n", chunk.Length, chunk.Cut, sha256.Sum256(chunk.Data))
count++
bytes += chunk.Length
@ -41,12 +48,6 @@ func main() {
} else if chunk.Length == chunker.MinSize {
min++
}
}
if err == io.EOF {
break
}
}
var avg int
@ -54,6 +55,6 @@ func main() {
avg = bytes / count
}
fmt.Fprintf(os.Stderr, "%d chunks, average size %d (%d min size, %d max size chunks)\n",
count, avg, min, max)
fmt.Fprintf(os.Stderr, "%d chunks from %d bytes, average size %d (%d min size, %d max size chunks)\n",
count, bytes, avg, min, max)
}