forked from TrueCloudLab/restic
backup: Save file size when reading from stdin
This commit is contained in:
parent
5e0813ca04
commit
43f9c2d36e
1 changed files with 3 additions and 0 deletions
|
@ -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())
|
||||
|
@ -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{
|
||||
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue