Skip to content

Commit

Permalink
Fix .fromFile() Node.js 14 compatibility (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanis Benson committed Oct 9, 2020
1 parent 0184c71 commit 80b71af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const handlers = {
.pipe(hasher)
.on('error', reject)
.on('finish', () => {
const {buffer} = hasher.read();
const {buffer} = new Uint8Array(hasher.read());
resolve({value: buffer, transferList: [buffer]});
});
}),
Expand All @@ -27,8 +27,8 @@ const handlers = {
hasher.update(input);
}

const hash = hasher.digest().buffer;
return {value: hash, transferList: [hash]};
const {buffer} = new Uint8Array(hasher.digest());
return {value: buffer, transferList: [buffer]};
}
};

Expand Down

0 comments on commit 80b71af

Please sign in to comment.