mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-10 00:30:29 +01:00
use buffered reader to write to encryption mechanism
This commit is contained in:
parent
ec87bd27e7
commit
bf562ea71d
@ -4,6 +4,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
@ -275,11 +276,12 @@ func (s *script) encryptBackup() error {
|
|||||||
return fmt.Errorf("encryptBackup: error encrypting backup file: %w", err)
|
return fmt.Errorf("encryptBackup: error encrypting backup file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
b, err := ioutil.ReadFile(s.file)
|
file, err := os.Open(s.file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("encryptBackup: error opening unencrypted backup file: %w", err)
|
return fmt.Errorf("encryptBackup: error opening backup file %s: %w", s.file, err)
|
||||||
}
|
}
|
||||||
pt.Write(b)
|
fileReader := bufio.NewReader(file)
|
||||||
|
fileReader.WriteTo(pt)
|
||||||
pt.Close()
|
pt.Close()
|
||||||
|
|
||||||
gpgFile := fmt.Sprintf("%s.gpg", s.file)
|
gpgFile := fmt.Sprintf("%s.gpg", s.file)
|
||||||
|
Loading…
Reference in New Issue
Block a user