Skip to content

Commit

Permalink
backup: Save file size when reading from stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
fd0 committed May 8, 2016
1 parent af39e93 commit e506705
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/restic/archive_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func ArchiveReader(repo *repository.Repository, p *Progress, rd io.Reader, name
chnker := chunker.New(rd, repo.Config.ChunkerPolynomial)

var ids backend.IDs
var fileSize uint64

for {
chunk, err := chnker.Next(getBuf())
Expand Down Expand Up @@ -72,6 +73,7 @@ func ArchiveReader(repo *repository.Repository, p *Progress, rd io.Reader, name
ids = append(ids, id)

p.Report(Stat{Bytes: uint64(chunk.Length)})
fileSize += uint64(chunk.Length)
}

tree := &Tree{
Expand All @@ -82,6 +84,7 @@ func ArchiveReader(repo *repository.Repository, p *Progress, rd io.Reader, name
ModTime: time.Now(),
Type: "file",
Mode: 0644,
Size: fileSize,
UID: sn.UID,
GID: sn.GID,
User: sn.Username,
Expand Down

0 comments on commit e506705

Please sign in to comment.