Skip to content

Commit

Permalink
fix(cubejs-cli): Fix file hashing for Cube Cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
paveltiunov committed Jun 9, 2020
1 parent 59d4a24 commit ce8e090
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/cubejs-cli/DeployDir.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,10 @@ class DeployDir {
fileHash(file) {
return new Promise((resolve, reject) => {
const hash = crypto.createHash('sha1');
return fs.createReadStream(file)
.pipe(hash.setEncoding('hex'))
.on('finish', () => {
resolve(hash.digest('hex'));
})
.on('error', (err) => {
reject(err);
});
const stream = fs.createReadStream(file);
stream.on('error', err => reject(err));
stream.on('data', chunk => hash.update(chunk));
stream.on('end', () => resolve(hash.digest('hex')));
});
}
}
Expand Down

0 comments on commit ce8e090

Please sign in to comment.