Use hash stream instead of crypto.createHash
crypto.createHash is a write stream but not a PassThrough stream!
This commit is contained in:
@@ -19,6 +19,7 @@ const assert = require('assert'),
|
||||
debug = require('debug')('box:backupformat/rsync'),
|
||||
{ EncryptStream } = require('../hush.js'),
|
||||
fs = require('fs'),
|
||||
HashStream = require('../hash-stream.js'),
|
||||
hush = require('../hush.js'),
|
||||
path = require('path'),
|
||||
paths = require('../paths.js'),
|
||||
@@ -52,7 +53,7 @@ async function addFile(sourceFile, encryption, uploader, progressCallback) {
|
||||
progressCallback({ message: `Uploading ${sourceFile}: ${transferred}M@${speed}MBps` }); // 0M@0MBps looks wrong
|
||||
});
|
||||
|
||||
const hash = crypto.createHash('sha256');
|
||||
const hash = new HashStream();
|
||||
|
||||
let pipeline = null;
|
||||
if (encryption) {
|
||||
|
||||
@@ -8,6 +8,7 @@ const assert = require('assert'),
|
||||
debug = require('debug')('box:backupformat/tgz'),
|
||||
{ DecryptStream, EncryptStream } = require('../hush.js'),
|
||||
fs = require('fs'),
|
||||
HashStream = require('../hash-stream.js'),
|
||||
path = require('path'),
|
||||
ProgressStream = require('../progress-stream.js'),
|
||||
promiseRetry = require('../promise-retry.js'),
|
||||
@@ -141,7 +142,7 @@ async function tarPack(dataLayout, encryption, uploader, progressCallback) {
|
||||
|
||||
const pack = tar.pack();
|
||||
|
||||
const hash = crypto.createHash('sha256');
|
||||
const hash = new HashStream();
|
||||
|
||||
let pipeline = null;
|
||||
if (encryption) {
|
||||
|
||||
Reference in New Issue
Block a user