Skip to content

Commit ce8e090

Browse files
committed
fix(cubejs-cli): Fix file hashing for Cube Cloud
1 parent 59d4a24 commit ce8e090

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

packages/cubejs-cli/DeployDir.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,10 @@ class DeployDir {
3939
fileHash(file) {
4040
return new Promise((resolve, reject) => {
4141
const hash = crypto.createHash('sha1');
42-
return fs.createReadStream(file)
43-
.pipe(hash.setEncoding('hex'))
44-
.on('finish', () => {
45-
resolve(hash.digest('hex'));
46-
})
47-
.on('error', (err) => {
48-
reject(err);
49-
});
42+
const stream = fs.createReadStream(file);
43+
stream.on('error', err => reject(err));
44+
stream.on('data', chunk => hash.update(chunk));
45+
stream.on('end', () => resolve(hash.digest('hex')));
5046
});
5147
}
5248
}

0 commit comments

Comments
 (0)