2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-22 12:55:18 +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 { for {
chunk, err := ch.Next() 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)) fmt.Printf("%d %016x %02x\n", chunk.Length, chunk.Cut, sha256.Sum256(chunk.Data))
count++ count++
bytes += chunk.Length bytes += chunk.Length
@ -41,12 +48,6 @@ func main() {
} else if chunk.Length == chunker.MinSize { } else if chunk.Length == chunker.MinSize {
min++ min++
} }
}
if err == io.EOF {
break
}
} }
var avg int var avg int
@ -54,6 +55,6 @@ func main() {
avg = bytes / count avg = bytes / count
} }
fmt.Fprintf(os.Stderr, "%d chunks, average size %d (%d min size, %d max size chunks)\n", fmt.Fprintf(os.Stderr, "%d chunks from %d bytes, average size %d (%d min size, %d max size chunks)\n",
count, avg, min, max) count, bytes, avg, min, max)
} }