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)
|
chnker := chunker.New(rd, repo.Config.ChunkerPolynomial)
|
||||||
|
|
||||||
var ids backend.IDs
|
var ids backend.IDs
|
||||||
|
var fileSize uint64
|
||||||
|
|
||||||
for {
|
for {
|
||||||
chunk, err := chnker.Next(getBuf())
|
chunk, err := chnker.Next(getBuf())
|
||||||
|
@ -72,6 +73,7 @@ func ArchiveReader(repo *repository.Repository, p *Progress, rd io.Reader, name
|
||||||
ids = append(ids, id)
|
ids = append(ids, id)
|
||||||
|
|
||||||
p.Report(Stat{Bytes: uint64(chunk.Length)})
|
p.Report(Stat{Bytes: uint64(chunk.Length)})
|
||||||
|
fileSize += uint64(chunk.Length)
|
||||||
}
|
}
|
||||||
|
|
||||||
tree := &Tree{
|
tree := &Tree{
|
||||||
|
@ -82,6 +84,7 @@ func ArchiveReader(repo *repository.Repository, p *Progress, rd io.Reader, name
|
||||||
ModTime: time.Now(),
|
ModTime: time.Now(),
|
||||||
Type: "file",
|
Type: "file",
|
||||||
Mode: 0644,
|
Mode: 0644,
|
||||||
|
Size: fileSize,
|
||||||
UID: sn.UID,
|
UID: sn.UID,
|
||||||
GID: sn.GID,
|
GID: sn.GID,
|
||||||
User: sn.Username,
|
User: sn.Username,
|
||||||
|
|
Loading…
Reference in a new issue