diff options
Diffstat (limited to 'src/lib.go')
-rw-r--r-- | src/lib.go | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -44,6 +44,12 @@ type Gauge struct { Dec func(...any) } +type CopyResult struct { + Written int64 + Err error + Label string +} + const MaxInt = int((^uint(0)) >> 1) @@ -364,6 +370,20 @@ func Scrypt( return PBKDF2Key(password, b, 1, keyLen, sha256.New), nil } +func CopyData( + c chan CopyResult, + label string, + from io.Reader, + to io.WriteCloser, +) { + written, err := io.Copy(to, from) + c <- CopyResult { + Written: written, + Err: err, + Label: label, + } +} + // FIXME: finish rewriting // // getV7Time returns the time in milliseconds and nanoseconds / 256. |