Skip to content

Commit bd8616a

Browse files
committed
refactor: streamline checksum and resumable upload logic
Simplify `HashStreamValidator._flush` by utilizing `md5Digest` getter.
1 parent ed87450 commit bd8616a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/hash-stream-validator.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,8 @@ class HashStreamValidator extends Transform {
9292
}
9393

9494
_flush(callback: (error?: Error | null | undefined) => void) {
95-
if (this.#md5Hash && !this.#md5Digest) {
96-
this.#md5Digest = this.#md5Hash.digest('base64');
97-
}
95+
// Triggers the getter logic to finalize and cache the MD5 digest
96+
this.md5Digest;
9897

9998
if (this.updateHashesOnly) {
10099
callback();

0 commit comments

Comments
 (0)