mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-05-07 05:32:45 +08:00
25 lines
790 B
Diff
25 lines
790 B
Diff
diff --git a/lib/stream-hash.js b/lib/stream-hash.js
|
|
index 3f9b44133766c04866ab2ab178c061f35dbf8f42..368ed6d94da4401909b7eddc87d18354947daf33 100644
|
|
--- a/lib/stream-hash.js
|
|
+++ b/lib/stream-hash.js
|
|
@@ -7,19 +7,15 @@ class StreamHash extends Transform {
|
|
constructor(attachment, algo) {
|
|
super();
|
|
this.attachment = attachment;
|
|
- this.algo = (algo || 'md5').toLowerCase();
|
|
- this.hash = crypto.createHash(algo);
|
|
this.byteCount = 0;
|
|
}
|
|
|
|
_transform(chunk, encoding, done) {
|
|
- this.hash.update(chunk);
|
|
this.byteCount += chunk.length;
|
|
done(null, chunk);
|
|
}
|
|
|
|
_flush(done) {
|
|
- this.attachment.checksum = this.hash.digest('hex');
|
|
this.attachment.size = this.byteCount;
|
|
done();
|
|
}
|